gpt4 book ai didi

html - 不使用表格如何实现表格布局?

转载 作者:太空狗 更新时间:2023-10-29 13:04:55 24 4
gpt4 key购买 nike

以进步(和学习)的名义,我怎样才能从我的代码中删除表格并实现相同的布局?

例如,这是我的表:

<table cellspacing="0px">
<tr>
<td>
<img src="http://www.poltairhomes.com/images/footerlogo.png" />
</td>
<td id="footertext">
<p>Poltair Homes Plc<br />Registered Office: The Old Chapel, Greenbottom, Truro, Cornwall, TR4 8QP.<br />Registered in England & Wales: 3955425<br />www.poltairhomes.com<br />info@poltairhomes.com</p>
</td>
<td id="footertext">
<p>Terms and Conditions | Privacy Policy | Sitemap</p>
</td>
<td id="footertext">
<p>SIGN UP FOR OUR NEWSLETTER:</p>
<img src="http://www.poltairhomes.com/images/signup(temp).png" />
</td>
</tr>
</table>

以及相关的 CSS:

.footertext {
margin: 0;
padding:0 5px 0 5px;
color: #AAA;
font-size: 10px;
font-family:Arial, Helvetica, sans-serif;
text-align:center;
border-left: 1px solid #CCC;
}

http://jsfiddle.net/userdude/tYjKw/

最佳答案

CSS:

.table {
display: table;
}
.table-row {
display: table-row;
}
.table-cell {
display: table-cell;
}

HTML:

<div class="table">
<div class="table-row">
<div class="table-cell">Table cell 1</div>
<div class="table-cell">Table cell 2</div>
</div>
</div>

关于html - 不使用表格如何实现表格布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11049149/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com