繁体   English   中英

如何使用CSS将文本从一个框流到另一个框

[英]How to flow text from a box to another with CSS

我在html中有几个框

<div class="parent">
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
</div>

用CSS定义

.box{
width : 200px;
height : 300px;
display :  block;
float : left
}

有没有一种方法可以在父DIV提供日志文本,并使用CSS在子DIV传递文本? 还是应该用Javascript完成?

当然,在哪里提供文本都没有关系,我只想将多余的文本传递到下一个框。

将您的HTML更改为包含内容的单个元素,例如:

<div class="parent">
  <div class="box"></div>
</div>

然后添加以下样式规范:

.box {
   -moz-column-count: 3;
   -webkit-column-count: 3;
   column-count: 3;
   height: 10em; /* Or whatever height is appropriate. */
}

有关CSS列的更多信息,请参见http://css-tricks.com/snippets/css/multiple-columns/https://developer.mozilla.org/en-US/docs/CSS/Using_CSS_multi-column_layouts#The_columns_shorthand

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM