Open In App

Primer CSS Typography Type Scale

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.

Typography is an important utility to design the content of the website. The Type Scale utility is used to increase or decrease the size of the text. There are different classes provided for changing the text size.

Primer CSS Typography Type Scale Classes:

  • .f1 – .f6: Add the .f1 to .f6 class to the respective element to implement this utility.

Syntax:

<p class="f1">
    ...
</p>

Example 1: This example demonstrates the use of the Primer CSS Typography Type Scale using the .f1 to .f6 class.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Primer CSS Typography</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 Typography Type Scale Utility</h3>
    </div>
    <div class="text-center">
        <p class="f1">Geeks for Geeks</p>
  
        <p class="f2">Geeks for Geeks</p>
  
        <p class="f3">Geeks for Geeks</p>
  
        <p class="f4">Geeks for Geeks</p>
  
        <p class="f5">Geeks for Geeks</p>
  
        <p class="f6">Geeks for Geeks</p>
  
    </div>
</body>
</html>


Output:

Typography type scale

Example 2: This example demonstrates the lighter font-weight available in the Primer CSS typography.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Primer CSS Typography Type Scale</title>
    <link rel="stylesheet" href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css" />
</head>
  
<body style="margin:80px">
    <div class="text-center">
        <h1 class="color-fg-success"> GeeksforGeeks </h1>
        <h3><u>Primer CSS Typography Type Scale</u></h3><br />
    </div>
  
    <div class="text-center">
        <h1 class="f3-light">Geeks for Geeks</h1>
        <h1 class="f2-light">Geeks for Geeks</h1>
        <h1 class="f1-light">Geeks for Geeks</h1>
        <h1 class="f0-light">Geeks for Geeks</h1>
        <h1 class="f00-light">Geeks for Geeks</h1>   
    </div>
</body>
  
</html>


Output:

Lighter Font Weight

Reference: https://primer.style/css/utilities/typography#type-scale-utilities



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