Open In App

Primer CSS Typography Line Height Styles

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.

In this article, we will learn about Primer CSS Typography Line Height Styles. Line Height Styles sets the height of a line box. It’s commonly used to set the distance between lines of text.

Primer CSS Typography Line Height classes:

  • lh-default: This class is used to set the distance between lines to 1.5
  • lh-condensed: This class is used to set the distance between lines to 1.25.
  • lh-condensed-ultra: This class is used to set the distance between lines to 1.

Responsive variants classes: 

  • lh-sm-condensed:  This class is used to set the distance between lines to 1.25 on small screens.
  • lh-md-condensed: This class is used to set the distance between lines to 1.25 on medium screens.
  • lh-lg-condensed: This class is used to set the distance between lines to 1.25 on large screens.
  • lh-xl-condensed: This class is used to set the distance between lines to 1.25 on extra-large screens.

Syntax:

<p class="Typography-Line-Height-Class">
       ...
</p>

Similarly, all classes have their responsive variants depending upon screen sizes.

Note: We can set the line-height to 0, by using class lh-0.

Example 1: In this example, we will learn about different line-height classes namely lh-default, lh-condensed, and lh-condensed-ultra

HTML




<!DOCTYPE html>
<html>
 
<head>
    <link href=
"https://unpkg.com/@primer/css@^16.0.0/dist/primer.css"
        rel="stylesheet" />
 
    <style>
        body {
            margin-left: 10px;
            margin-right: 10px;
        }
    </style>
</head>
 
<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
     
    <h3>Typography Line Height</h3>
 
    <h2>lh-default</h2>
 
    <p class="lh-default">
        GeeksforGeeks is a computer science portal.
        It provides trainings in wide variety of
        courses like C++, Java, CSS, HTML, Bootstrap.
        It also facilitates training in Blockchain,
        Full Stack Development, and other courses
        that are currently required to by the
        student to build their concepts. GeeksforGeeks
        also helps students to secure a job. They
        conduct various technical sessions of Data
        structures and other modules like operating
        system.
    </p>
 
 
    <h2>lh-condensed</h2>
    <p class="lh-condensed">
        GeeksforGeeks is a computer science portal.
        It provides trainings in wide variety of
        courses like C++, Java, CSS, HTML, Bootstrap.
        It also facilitates training in Blockchain,
        Full Stack Development, and other courses
        that are currently required to by the
        student to build their concepts. GeeksforGeeks
        also helps students to secure a job. They
        conduct various technical sessions of Data
        structures and other modules like operating
        system.
    </p>
 
 
 
    <h2>lh-condensed-ultra</h2>
    <p class="lh-condensed-ultra">
        GeeksforGeeks is a computer science portal.
        It provides trainings in wide variety of
        courses like C++, Java, CSS, HTML, Bootstrap.
        It also facilitates training in Blockchain,
        Full Stack Development, and other courses
        that are currently required to by the
        student to build their concepts. GeeksforGeeks
        also helps students to secure a job. They
        conduct various technical sessions of Data
        structures and other modules like operating
        system.
    </p>
 
 
</body>
 
</html>


Output:

 

Example 2: In this example, we will set the line-height to 0 by using lh-0 class.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <link href=
"https://unpkg.com/@primer/css@^16.0.0/dist/primer.css"
         rel="stylesheet" />
 
     <style>
      body{
        margin-left:10px;
        margin-right:10px;
      }   
    </style>
</head>
 
<body>
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
     
    <h3> Typography Line Height</h3>
     
    <h2>lh-0</h2>
 
    <p class="lh-0">       
        GeeksforGeeks is a computer science portal.
        It provides trainings in wide variety of
        courses like C++, Java, CSS, HTML, Bootstrap.
        It also facilitates training in Blockchain,
        Full Stack Development, and other courses
        that are currently required to by the
        student to build their concepts. GeeksforGeeks
        also helps students to secure a job. They
        conduct various technical sessions of Data
        structures and other modules like operating
        system
    </p>
 
  
</body>
 
</html>


Output:

 

Reference: https://primer.style/css/utilities/typography#line-height-styles



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