How to display content in multiple columns using CSS
Break content into multiple columns using orphans or widows property in CSS

I am a Front end developer currently working on React JS, HTML, CSS, Python, Vue JS, Webpack, Babel, AEM etc.
Search for a command to run...
Break content into multiple columns using orphans or widows property in CSS

I am a Front end developer currently working on React JS, HTML, CSS, Python, Vue JS, Webpack, Babel, AEM etc.
Are you planning to start your coding journey?. Then this is for you - a roadmap to help you achieve your goals.

7 ways in which you can add files to your commit using git add

As a website user, one would have come across links or buttons which say "Click to download" or "Download" on a website. Have you ever wondered how can you add one to your website?. Keep reading!!!. As part of this blog let us see how one can crea...

Display Hello World and custom message using two-way data binding

Build a random quote generator using an API - JavaScript

Kritika Pattalam Bharathkumar | Web Developer - The official blog of Kritika Pattalam Bharathkumar
22 posts
Front End Engineer | Writes about HTML, CSS, JavaScript and everything related to web development | Follow me on Twitter let's chat.
In this article, we are going to see how or when orphans or widows property in CSS can be used in showing content as multiple columns.
[P.S : Refer the codepen given below to see visually how each property behaves]
Consider that you have a list of paragraphs and you want to show it in 3 or 4 columns and also decide where or how the content can break. Let's see the first step on how you can split the content in a simple way.
columns: 3 // should be a positive integer. Here the paragraph will be split into 3 columns.
.split-3-columns {
display: block;
columns: 3; // value based on how many columns you want the content to split
height: 250px; // height of the div as per your need
}
In the above example, columns property accepts a positive integer value.Eg: value 3 means, the paragraphs will be split into 3 columns in the browser. When the content is split into multiple columns at times the layout or the paragraph might not look as expected.
Eg: You might end up seeing something below, where in the second column, the column begins with the last line of the paragraph and seeing it in just two line looks weird. In this case you might wish that when the content does break you might want to show the last three lines of a paragraph at the start of the column instead of just two lines. This is where widows come into the picture. The same goes for the paragraph for "It was popularised..." the first lines of the paragraph at the bottom of the column is in 2 lines, but you want to change how many lines of a paragraph are shown at the bottom of the column, this can be done using orphans.

The orphans property sets the minimum number of lines that can stay by themselves at the bottom of a fragment(columns) before a fragmentation(column) break. The value must be positive and applies to block level container elements. This value typically affects the first line of the paragraph
.split-3-columns {
display: block;
orphans: 1;
columns: 3; // value based on how many columns you want the content to split
height: 250px; // height of the div as per your need
}
The widow property sets the minimum number of lines that can stay by themselves at the top of a new fragment(column) after a fragmentation(column) break. The value must be positive and applies to block level container elements. This value is typically for the last line of a paragraph
.split-3-columns {
display: block;
widows: 5;
columns: 3; // value based on how many columns you want the content to split
height: 250px; // height of the div as per your need
}
This is supported in all major browsers except for firefox in desktop and android firefox in mobile. For more details refer the MDN docs given below in the references section.
Lets connect on Twitter | LinkedIn for more web development related chats.