CSS | column-fill Property

The column-fill property in CSS is used to specify whether the columns will be filled in a balanced manner or not.

Syntax:

column-fill: balance|auto|initial|inherit

Property Values:



  • balance: This is the default value for the property. This value fills each column with the same amount of content, but will not allow the columns to be taller than the height.
  • auto: This value fills each column until it reaches the height
  • initial:This value is used to set the column-fill property to its default value.
  • inherit: This value is used to inherits the column-fill property from its parent.

Example: To illustrate the auto value and balanced value for the column-fill property.

filter_none

edit
close

play_arrow

link
brightness_4
code

DOCTYPE html>
<html>
  
<head>
    <title>The column-fill Property</title>
    <style>
        div {
            -webkit-column-count: 3;
            -moz-column-count: 3;
            column-count: 3;
            height: 100px;
        }
          
        .gfg1 {
            -moz-column-fill: auto;
            column-fill: auto;
        }
          
        .gfg2 {
            -moz-column-fill: balance;
            column-fill: balance;
        }
          
        h1 {
            color: green;
        }
          
        h1,
        h2 {
            text-align: center;
        }
    </style>
</head>
  
<body>
  
    <h1>
    GeeksforGeeks
</h1>
    <h2>
    The column-fill Property
</h2>
  
    <h2>column-fill: auto:</h2>
    <div class="gfg1">
        The course is designed for students
    as well as working professionals to 
    prepare for coding interviews. This
    course is going to have coding questions
    from school level to the level needed for
    product based companies like Amazom,
    Microsoft, Adobe, etc.
    </div>
  
    <h2>column-fill: balance (default):</h2>
    <div class="gfg2">
        The course is designed for students
    as well as working professionals to 
    prepare for coding interviews. This
    course is going to have coding questions
    from school level to the level needed for
    product based companies like Amazom,
    Microsoft, Adobe, etc
    </div>
</body>
  
</html>                    

chevron_right


Output:

Supported Browsers: The browsers supported by CSS | column-fill Property are listed below:

  • Google Chrome 50.0, 4.0 -webkit-
  • Internet Explorer 10.0
  • Firefox 52.0, 2.0 -moz-
  • Opera 37.0, 15.0 -webkit-, 11.1
  • Safari 9.0, 3.1 -webkit-


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.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.