将流体表转换为div / css

时间:2010-12-01 21:17:48

标签: html css html-table

如何仅使用div转换此3列表?请注意,第一列和第三列是流体的,只有第二列(中间)是固定宽度。

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td style="background-color:#CCC;">left</td>
    <td style="width:940px; background-color:#0CF;">middle</td>
    <td style="background-color:#FF9;">right</td>
  </tr>
</table>

2 个答案:

答案 0 :(得分:0)

本文介绍了如何完成所需的基于DIV的布局: http://www.barelyfitz.com/screencast/html-training/css/positioning/

基本上,将容器DIV设为100%宽度,然后在其中放置3个“列”DIV。

答案 1 :(得分:0)

也许这会有所帮助:http://matthewjamestaylor.com/blog/perfect-3-column.htm

你的这个问题并不像你认为的那样简单。可以直接设置3个div并使其宽度都符合您的要求。让所有这三个div的高度按你想要的方式运行会有点棘手。

这篇文章虽然不是专门针对您的问题的教程,但可能会为您提供一些好的见解和想法:http://www.alistapart.com/articles/css-positioning-101/

修改 针对您的问题的更具体的文章:http://www.alistapart.com/articles/holygrail/