簡體   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