Open In App

Primer CSS Box Headers with Counters

Last Updated : 19 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 Box is used to display the content in the simple rounded corner box. Primer CSS Box Headers with Counters is used to create the box header with the counter using the Counter class. We will use Counter–gray to make the background color gray and the text color dark. In this article, we will discuss the Primer CSS Box Headers with Counters.

Primer CSS Box Headers with Counters Classes:

  • Box-header: This class is used to create the Box header.
  • Box-title: This class is used to create the header title.
  • Counter: This class is used to create the counter with the header.
  • Counter–gray: This class is used to change the counter background color to gray and text color to dark.

Syntax:

<div class="Box">
  <div class="Box-header">
    <h3 class="Box-title">
      ...
      <span class="Counter Counter--gray"> 
          ... 
      </span>
    </h3>
  </div>
</div>

Example 1: The following code demonstrates the Primer CSS Box Headers with Counters.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title> Primer CSS Box Headers with Counters </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 Box Headers with Counters </h3>
    </div> <br> <br>
  
    <div class="Box">
        <div class="Box-header">
            <h3 class="Box-title">
              GeeksforGeeks
              <span class="Counter Counter--gray">5</span>
            </h3>
        </div>
    </div>
</body>
  
</html>


Output:

Primer CSS Box Headers with Counters

Example 2: The following code demonstrates the Primer CSS Box Headers with Counters.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title> Primer CSS Box Headers with Counters </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 Box Headers with Counters </h3>
    </div> <br> <br>
  
    <div class="Box">
        <div class="Box-header Box-row--yellow">
            <h3 class="Box-title">
                GeeksforGeeks
                <span class="Counter Counter--gray">42</span>
            </h3>
        </div>
        <div class="Box-body">
            <img src=
        </div>
    </div>
</body>
  
</html>


Output:

Primer CSS Box Headers with Counters

Reference: https://primer.style/css/components/box#box-headers-with-counters



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

Similar Reads