Open In App

Primer CSS Layout Column Gutter

Primer CSS is a free and open-source CSS framework that is built using the GitHub design system for providing support to the broad spectrum of GitHub websites. It helps in creating the foundation of the basic style elements such as spacing, components, typography, color, etc.

Primer CSS Gutter styles add padding to the left and right side of each column of layouts and apply a negative margin to the container so that the content inside each column lines up with content outside of the grid. Column Gutter helps in setting the gap (gutter) between elements layout columns i.e, between the main layout and sidebar layout. In this article, we will learn about Primer CSS Layout Column Gutter.



Primer CSS Layout Column Gutter Classes used:

Syntax:



<div class="Layout Layout--gutter-none">
  <div class="Layout-main border">
    ...
  </div>

  <div class="Layout-sidebar border">
    ...
  </div>
</div>

Example 1: Below example demonstrates the default column gutter.




<!DOCTYPE html>
<html lang="en">
 <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content=
          "width=device-width, initial-scale=1.0" />
    <title>Primer CSS</title>
    <link href=
"https://unpkg.com/@primer/css@^19.0.0/dist/primer.css"
      rel="stylesheet"
    />
</head>
<body>
    <div class="m-4">
        <h1 style="color: green">GeeksforGeeks</h1>
        <h2>Primer CSS Layout Column Gutter</h2>
    </div>
  
    <div class="Layout m-4">
        <div class="Layout-main border color-bg-success p-2">
          Jobs
        </div>
  
        <div class="Layout-sidebar border color-bg-accent p-2">
          GeeksforGeeks
        </div>    
    </div>
</body>
</html>

Output:

 

Example 2: Below example demonstrates the column gutter none using the Layout–gutter-none class.




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content=
         "width=device-width, initial-scale=1.0" />
    <title>Primer CSS</title>
    <link href=
"https://unpkg.com/@primer/css@^19.0.0/dist/primer.css"
      rel="stylesheet"/>
</head>
<body>
    <div class="m-4">
        <h1 style="color: green">GeeksforGeeks</h1>
        <h2>Primer CSS Layout Column Gutter</h2>
    </div>
  
    <div class="Layout Layout--gutter-none m-4">
        <div class="Layout-main border color-bg-success p-2">
          Tutorials
        </div>
  
        <div class="Layout-sidebar border color-bg-accent p-2">
          GeeksforGeeks
        </div>
    </div
</body>
</html>

Output:

 

Example 3: Below example demonstrates the column gutter condensed using the Layout–gutter-condensed class.




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content=
          "width=device-width, initial-scale=1.0" />
    <title>Primer CSS</title>
    <link href=
"https://unpkg.com/@primer/css@^19.0.0/dist/primer.css"
      rel="stylesheet"
    />
</head>
<body>
    <div class="m-4">
        <h1 style="color:green">GeeksforGeeks</h1>
        <h2>Primer CSS Layout Column Gutter</h2>
    </div>
  
    <div class="Layout Layout--gutter-condensed m-4">
        <div class="Layout-main border color-bg-success p-2">
            Premium
        </div>
      
        <div class="Layout-sidebar border color-bg-accent p-2">
            GeeksforGeeks
        </div>
    </div>
</body>
</html>

Output:

 

Example 4: Below example demonstrates the column gutter spacious using the Layout–gutter-spacious class.




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content=
"width=device-width, initial-scale=1.0" />
    <title>Primer CSS</title>
    <link href=
"https://unpkg.com/@primer/css@^19.0.0/dist/primer.css"
          rel="stylesheet"
    />
</head>
<body>
    <div class="m-4">
        <h1 style="color:green">GeeksforGeeks</h1>
        <h2>Primer CSS Layout Column Gutter</h2>
    </div>
  
    <div class="Layout Layout--gutter-spacious m-4">
        <div class="Layout-main border color-bg-success p-2">
            Jobs
        </div>
      
        <div class="Layout-sidebar border color-bg-accent p-2">
            GeeksforGeeks
        </div>
    </div>    
</body>
</html>

Output:

 

Reference: https://primer.style/css/components/layout#column-gutter


Article Tags :