Set how many columns an element should span across with CSS


To set how many columns an element should span, use the column-span property. You can try to run the following code to implement the column-span property:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         .demo {
            column-count: 4;
            column-rule-color: maroon;
            column-rule-style: dashed;
         }
         h1 {
            column-span: all;
         }
      </style>
   </head>
   <body>
      <div class = "demo">
         <h1>This is our heading.</h1>
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
      </div>
   </body>
</html>

Updated on: 24-Jun-2020

83 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements