简体   繁体   中英

Equally distribute text within CSS column property

I've divided a text into 4 columns with CSS column property and the result is something like this

Now what i would like to do is to equally distribute the text in a way that i could get something like this

Code:

 #container { background: rgba(255, 237, 0, 1.00); width: 100%; -webkit-column-count: 4; -webkit-column-gap: 15px; -webkit-column-rule: 2px solid lightblue; -moz-column-count: 4; -moz-column-gap: 15px; -moz-column-rule: 2px solid lightblue; column-count: 4; column-gap: 15px; column-rule: 2px solid lightblue; } 
 <section id="container"> "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." </section> 

You might be running into browser support issues. Check out http://caniuse.com/#search=columns to see how supported columns are right now.

See this Jsfiddle for an example with browser prefixes that seem to do what you are asking for https://jsfiddle.net/82dnb1ab/

#container {
  background: rgba(255, 237, 0, 1.00);
  width: 100%;
  -webkit-column-count: 4;
  -webkit-column-gap: 15px;
  -webkit-column-rule: 2px solid lightblue;
  -moz-column-count: 4;
  -moz-column-gap: 15px;
  -moz-column-rule: 2px solid lightblue;
  column-count: 4;
  column-gap: 15px;
  column-rule: 2px solid lightblue;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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