Open In App

Primer CSS Button with Counts

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 Button with Counts is used to add the counter with the small button. To add the counter, we will use btn-with-count, btn-sm, and social-count classes. In this article, we will discuss Primer CSS Button with Counts.

Primer CSS Button with Counts Classes:

  • btn-sm: This class is used to create the small button.
  • btn-with-count: This class is used to create the button with the count.
  • social-count: This class is used to create the counter.

Syntax:

<div class="clearfix">
  <a class="btn btn-sm btn-with-count" 
               href="#url" role="button">
     ...
  </a>
  <a class="social-count" href="#url">...</a>
</div>

Example 1: Below example demonstrates the use of Primer CSS Button with Counts.

HTML




<!DOCTYPE html>
<html>
    
<head>
    <title> Primer CSS Button with Counts </title>
    <link rel="stylesheet" 
          href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css"/>
</head>
  
<body class="m-2">
    <h1 class="color-fg-success"> GeeksforGeeks </h1>
    <h3> Primer CSS Button with Counts </h3> <br>
  
    <div class="clearfix">
        <a class="btn btn-sm btn-with-count" href="#" role="button">
          <span> GFG </span>
        </a>
        <a class="social-count" href="#"> 12 </a>
    </div>
</body>
  
</html>


Output:

Primer CSS Button with Counts

Example 2: Below example demonstrates the use of Primer CSS Button with Counts.

HTML




<!DOCTYPE html>
<html>
    
<head>
    <title> Primer CSS Button with Counts </title>
    <link rel="stylesheet" 
          href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css"/>
</head>
  
<body class="m-2">
    <h1 class="color-fg-success"> GeeksforGeeks </h1>
    <h3> Primer CSS Button with Counts </h3> <br>
  
    <button class="btn btn-primary mr-1" type="button">
        Java <span class="Counter"> 4 </span>
    </button>
  
    <button class="btn btn-danger mr-1" type="button">
        Python <span class="Counter"> 45 </span>
    </button>
  
    <button class="btn btn-outline" type="button">
        C++ <span class="Counter"> 9 </span>
    </button>
</body>
  
</html>


Output:

Primer CSS Button with Counts

Reference: https://primer.style/css/components/buttons#button-with-counts



Last Updated : 25 Apr, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads