CSS 3列布局,溢出到下一行

时间:2016-03-10 18:10:19

标签: html css css-paged-media

是否有可能以某种方式使用固定高度的三列布局(使用列数:3;)溢出到下一行。基本上是HTML的分页媒体。

Overflow of Text from one Row into the next row of 3 fixed-height Columns

2 个答案:

答案 0 :(得分: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上。这是现场的例子:

https://jsfiddle.net/sLfcwtcg/

答案 1 :(得分:0)

  

对于旧浏览器功能,我更喜欢这种方式:

&#13;
&#13;
* { -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;}
&#13;
<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>
&#13;
&#13;
&#13;