Open In App

Primer CSS Typography Type Scale

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:

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.




<!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.




<!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


Article Tags :