How to prevent column break within an element?

We can prevent column break within an element by using a CSS break-inside Property. The break-inside property in CSS is used to specify how the column breaks inside the element. Sometimes content of an element is stuck between the column. To prevent column break we should use the break-inside Property set to avoid.

Syntax:

column-break-inside:avoid;

Example: This Example uses to prevent the column break within an element.



filter_none

edit
close

play_arrow

link
brightness_4
code

<html>
  
<head>
    <style>
        .x {
            -moz-column-count: 3;
            column-count: 3;
            width: 30em;
        }
          
        .x li {
            -webkit-column-break-inside: avoid;
        }
    </style>
</head>
  
<body>
    <h1>Geeks For Geeks</h1>
    <div class='x'>
        <ul>
            <li>GeeksForGeeks</li>
            <li>Sudo Placement</li>
            <li>DataBase management System</li>
            <li>Operating System</li>
                <li>A computer science portal for geeks.</li>
                <li>Java Programming</li>
        </ul>
    </div>
</body>
  
</html>

chevron_right


Output:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : shubham_singh