Skip to content
Related Articles
Open in App
Not now

Related Articles

Primer CSS Negative Offset Columns

Improve Article
Save Article
  • Last Updated : 20 Apr, 2022
Improve Article
Save Article

Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, and BEM architecture. It is highly reusable and flexible. It is created with GitHub’s design system.

Primer CSS offers Negative Offset Columns have classes that can be used to pull a div over a column distance to the left.

Primer CSS Negative Offset Columns  usedclasses:

  • offset-n1: This class is used to provide a 1 unit distance to the left.
  • offset-n2: This class is used to provide a 2 unit distance to the left.
  • offset-n3: This class is used to provide a 3 unit distance to the left.
  • offset-n4: This class is used to provide a 4 unit distance to the left.
  • offset-n5: This class is used to provide a 5 unit distance to the left.
  • offset-n6: This class is used to provide a 6 unit distance to the left.
  • offset-n7: This class is used to provide a 7 unit distance to the left.

Syntax:

 <div class="mx-auto border" style="width: 500px">
    <div class="offset-n1 
      col-4 border p-4">
      ...
    </div>
</div>

Example 1: Below example demonstrates the use of Primer CSS Negative Offset Columns with offset-n1, offset-n2, offset-n3, and offset-n4 classes. 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title> Primer CSS Negative Offset Columns </title>
    <link href=
"https://unpkg.com/@primer/css@^19.0.0/dist/primer.css"
        rel="stylesheet" />
</head>
  
<body>
    <h1 class="color-fg-success text-center">
        GeeksforGeeks
    </h1>
      
    <h3 class="text-center">
        Primer CSS Negative Offset Columns
    </h3>
  
    <div class="mx-auto border mt-5" style="width: 500px">
        <div class="offset-n1 col-4 border p-4">
            n1 distance left offset
        </div>
        <div class="offset-n2 col-4 border p-4">
            n2 distance left offset
        </div>
        <div class="offset-n3 col-4 border p-4">
            n3 distance left offset
        </div>
        <div class="offset-n4 col-4 border p-4">
            n4 distance left offset
        </div>
    </div>
</body>
  
</html>


Output:

Primer CSS Negative Offset Columns

Example 2: Below example demonstrates the use of Primer CSS Negative Offset Columns with offset-n5, offset-n6, and offset-n7 classes. 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Primer CSS Negative Offset Columns</title>
    <link href=
"https://unpkg.com/@primer/css@^19.0.0/dist/primer.css"
        rel="stylesheet" />
</head>
  
<body>
    <h1 class="color-fg-success text-center">
        GeeksforGeeks
    </h1>
      
    <h3 class="text-center">
        Primer CSS Negative Offset Columns
    </h3>
  
    <div class="mx-auto border mt-5" style="width: 500px">
        <div class="offset-n5 col-4 border p-4">
            n5 distance left offset
        </div>
        <div class="offset-n6 col-4 border p-4">
            n6 distance left offset
        </div>
        <div class="offset-n7 col-4 border p-4">
            n7 distance left offset
        </div>
    </div>
</body>
  
</html>


Output:

Primer CSS Negative Offset Columns

Reference: https://primer-css.vercel.app/css/utilities/marketing-layout#negative-offset-columns


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!