Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Writing In Columns (like a newspaper) [duplicate]

I'm using django and bootstrap, and I was wondering if there was a way to write in columns like a newspaper does. Obviously it is easy to create columns in bootstrap, but I was wondering how to have the text divide itself into the columns nicely so there is not one column that is longer. Also I would include a 'writers' section at the top of one of the columns so I would need to account for that.

I am thinking of just dividing the words in the columns by the number of columns but then I think that there would be one run on column, mostly because of the writers section.

like image 762
cdipaolo Avatar asked Jul 21 '14 18:07

cdipaolo


People also ask

What are offset columns in Bootstrap?

Column Offsetting: Column offsetting is used to move or push a column from its original position to a specified width or space. To implement column offsetting we use the '. col-md-n' class with '. col-md-offset-n' class which pushes column by n columns.

How do I make 5 columns in Bootstrap 4?

Populate the 'row' div with 5 divs with class 'col'. Because Bootstrap 4.0+ grid system has now shifted to Flexbox, the columns will arrange by themselves into five equally sized DOM elements.


1 Answers

For browsers that support it, you can use columns css3 property:

.twoColumns{
    -webkit-column-gap: 20px;
       -moz-column-gap: 20px;
            column-gap: 20px;
    -webkit-column-count: 2;
       -moz-column-count: 2;
            column-count: 2;
}
<div class="twoColumns">
    Sed ut perspiciatis unde omnis iste natus error ...
</div>

Demo in Fiddle


If you need to support older browsers, you can use the polyfill here:

https://github.com/BetleyWhitehorne/CSS3MultiColumn

Include the script after your stylesheet and it will convert if neccessary:

<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script type="text/javascript" src="css3-multi-column.js"></script>

Or you can do it in Javascript with Columnizer like this:

$('.twoColumns').columnize({ columns: 2 });
like image 154
KyleMit Avatar answered Oct 14 '22 11:10

KyleMit