如果它是真正的表格布局,那么使用html表是合适的.如果它不是真正的表格布局,那么如果要保持HTML不变,这就是CSS中所需的内容:
.small {float:left; clear: both;}
.left {float:left: clear: both;}
.right {float:left;}
“清楚:两者”有点像回车(对于所有有记忆的打字机的人来说都是!)
“float:left”将东西水平放置在彼此旁边而不是框元素的自然垂直堆叠(如div).
对于我自己的table-ish CSS布局,我只使用两个类,“row”和“column”,如下所示:
/* Standard CSS for div tables. By Tom Haws
* Overview:
* 1. a row is a Box element that wants all its children to be
* arranged in a (horizontal) row
* and is itself a new line rather than a continuation of a line.
* 2. a column is a Box element that wants all its children to be
* arranged in a (vertical) column
* and is itself a continuation of a line unless it is
* the first column in a row.
*
* */
/* Any child of a row AND any column class that is anything but first-child
* represents another column continuing the same row
* */
.row>*,.column
{
float: left;
}
/* Every first child of a row and every column that is a first child of any parent
* represents a new row (first column)
* */
.row>*:first-child,.column:first-child
{
clear: both;
float: left;
}
/* All rows and all children of a column are a new line.
* */
.row,.column>*
{
clear: both;
float: left;
}
这是我如何做你的小例子:
随意询问有关CSS标记的细微差别以及它正在做什么的任何后续行动.
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。