Open In App

Primer CSS Typography Text Alignment

Last Updated : 12 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.

In this article, we will discuss about Typography Text Alignment. Typography Text Alignment is used to left align, center, or right align text.

Class:

  • text-left: This class is used to align the text to left.
  • text-center: This class is used to align the text to center.
  • text-right: This class is used to align the text to right.

Syntax:

<p class="text-* ">
    Content
</p>

This * can be substituted with the respective classes as mentioned above.

Example 1: In this example, we will write some text and use text-left class to left-align it.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
"https://unpkg.com/@primer/css@^16.0.0/dist/primer.css" />
</head>
  
<body>
    <div>
        <h1 style="color:green">GeeksforGeeks</h1>
        <h3> Typography Text Align</h3>
    </div>
    <h3 style="color:red">Text-Left</h3>
    <p class="text-left">
        GeeksforGeeks is a Computer Science Portal
    </p>
</body>
</html>


Output:

 

Example 2: In this example, we will write some text and use text-center class to center-align it.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
"https://unpkg.com/@primer/css@^16.0.0/dist/primer.css" />
</head>
  
<body>
    <div>
        <h1 style="color:green">GeeksforGeeks</h1>
        <h3> Typography Text Align</h3>
    </div>
    <h3 style="color:red">Text-Center</h3>
    <p class="text-center">
        GeeksforGeeks is a Computer Science Portal
    </p>
</body>
</html>


Output:

 

Example 3: In this example, we will write some text and use text-right class to right-align it.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
"https://unpkg.com/@primer/css@^16.0.0/dist/primer.css" />
</head>
  
<body>
    <div>
        <h1 style="color:green">GeeksforGeeks</h1>
        <h3> Typography Text Align</h3>
    </div>
    <h3 style="color:red">Text-Right</h3>
    <p class="text-right">
        GeeksforGeeks is a Computer Science Portal
    </p>
</body>
</html>


Output:

 

Reference: https://primer.style/css/utilities/typography#text-alignment



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

Similar Reads