Open In App

Primer CSS Grid Column Widths

Last Updated : 25 Apr, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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 Grid Column Widths are used to specify the percentage-based columns widths to any block and inline element.

Primer CSS Grid Column Widths Classes:

  • col-*: This class is used to specify the number of columns the element is taking.
  • float-right: This class is used to float the element right.

Syntax:

<div>
  <div class="col-4 float-right">
    ...
  </div>
  <p> .... </p>
</div>

Example 1: The following example demonstrates the Primer CSS Grid Column Widths.

HTML




<!DOCTYPE html>
<html>
      
<head>
    <title> Primer CSS Grid Column Widths </title>
    <link rel="stylesheet" 
          href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css"/>
</head>
  
<body>
    <div class="text-center">
        <h1 class="color-fg-success"> GeeksforGeeks </h1>
        <h3> Primer CSS Grid Column Widths </h3> <br>
          
        <div>
            <div class="col-4 float-right p-1 
                 border-dashed color-fg-success">
              <strong> Floated right </strong>
            </div>
            <p
                A Computer Science portal for geeks. 
                It contains well written, well thought
                and well explained computer science and
                programming articles
            </p>
        </div>
    </div>
</body>
  
</html>


Output:

Primer CSS Grid Column Widths

Example 2: The following example demonstrates the Primer CSS Grid Column Widths using images.

HTML




<!DOCTYPE html>
<html>
      
<head>
    <title> Primer CSS Grid Column Widths </title>
    <link rel="stylesheet" 
          href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css"/>
</head>
  
<body>
    <div class="text-center">
        <h1 class="color-fg-success"> GeeksforGeeks </h1>
        <h3> Primer CSS Grid Column Widths </h3> <br>
          
        <div>
            <div class="col-3 float-right p-1 
                    color-fg-success">
                <img src=
            </div>
  
            <div class="col-4 float-right p-1 
                    color-fg-success">
                <img src=
            </div>
              
            <p
                A Computer Science portal for geeks. 
                It contains well written, well thought
                and well-explained computer science and
                programming articles.
                A Computer Science portal for geeks. 
                It contains well written, well thought
                and well-explained computer science and
                programming articles
            </p>
        </div>
    </div>
</body>
  
</html>


Output:

Primer CSS Grid Column Widths

Reference: https://primer.style/css/utilities/grid#column-widths



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads