Skip to content
Related Articles

Related Articles

CSS break-before Property
  • Last Updated : 18 Sep, 2020

The CSS break-before property is used to mention page break, region break, or column break should occur before the element or not. This property is ignored, if there is no generated box.

Syntax:

break-before: Generic break values;

Or

break-before: Page break values;

Or

break-before: Column break values;

Or



break-before: Region break values;

Or

break-before: Global values;

Property values: This property accepts the property values mentioned above and described below.

  • Generic break values: This property refers to the values defined by auto, avoid, always, all,etc.
  • Page break values: This property refers to the values defined by page, avoid-page, left, right, recto, verso, etc.
  • Column break values: This property refers to the values defined by column, avoid-column, etc.
  • Region break values: This property refers to the values defined by region, avoid-region, etc.
  • Global values: This property refers to the values defined by inherit, initial, unset, etc.

Example: Below is the example which illustrates the use of break-before property

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <style>
        h1 {
            color: #008000;
            text-align: center;
            font-size: 3rem;
            column-span: all;
        }
  
        h2 {
            color: green;
            break-before: column;
        }
  
        p {
            line-height: 1.5;
        }
  
        div {
            column-width: 250px;
            gap: 30px;
        }
    </style>
</head>
  
<body>
    <div>
        <h1>GeeksforGeeks</h1>
  
        <h2>geek 1</h2>
  
        <p>
            Computer Science portal 1
            Computer Science portal 1
            Computer Science portal 1
            Computer Science portal 1
            Computer Science portal 1
            Computer Science portal 1
            Computer Science portal 1
            Computer Science portal 1
            Computer Science portal 1
        </p>
  
        <h2>geek 2</h2>
  
        <p>
            Computer Science portal 2
            Computer Science portal 2
            Computer Science portal 2
            Computer Science portal 2
            Computer Science portal 2
            Computer Science portal 2
            Computer Science portal 2
            Computer Science portal 2
            Computer Science portal 2
        </p>
  
        <h2>geek 3</h2>
  
        <p>
            Computer Science portal 3
            Computer Science portal 3
            Computer Science portal 3
            Computer Science portal 3
            Computer Science portal 3
            Computer Science portal 3
            Computer Science portal 3
            Computer Science portal 3
            Computer Science portal 3
        </p>
    </div>
</body>
  
</html>

Output:

Supported Browsers:

  • Chrome
  • Firefox (Partially Supported)
  • Safari (Partially Supported)
  • Opera
  • Internet Explorer
  • Edge

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :