是否有可能以某种方式有一个固定高度的三列布局(使用 column-count: 3;)溢出到下一行。基本上是 HTML 的分页媒体。
问问题
257 次
2 回答
1
http://www.w3schools.com/css/css3_multiple_columns.asp
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
</style>
</head>
<body>
<p><b>Note:</b> Internet Explorer 9, and earlier versions, does not support the column-count property.</p>
<div class="newspaper">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.
</div>
</body>
</html>
这将为您提供多列布局。如果您想要多列和多行视图,那么您可以将文本分成几个部分,然后将每个部分放在它自己的.newspaper
div 上。这是现场示例:
于 2016-03-10T18:15:58.507 回答
0
对于较旧的浏览器功能,我更喜欢这种方式:
* { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
/*
* Grid helpers inspired from Twitter Bootstrap
*/
.row { margin: 0 -10px; }
.row:before, .row:after { content: " "; display: table; }
.row:after { clear: both; }.row>div { padding: 0 10px; }
.col4{width:33.333333333333%;float:left;}
<h1>Title columns</h1>
<div class="row">
<div class="col4">
<p>lorem ipsum bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla blabla bla bla</p>
</div>
<div class="col4">
<p>lorem ipsum bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla blabla bla bla</p>
</div>
<div class="col4">
<p>lorem ipsum bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla blabla bla bla</p>
</div>
<div class="col4">
<p>lorem ipsum bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla blabla bla bla</p>
</div>
<div class="col4">
<p>lorem ipsum bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla blabla bla bla</p>
</div>
<div class="col4">
<p>lorem ipsum bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla blabla bla bla</p>
</div>
</div>
于 2018-03-07T15:57:24.897 回答