Skip to content
Related Articles

Related Articles

Typography in Bootstrap

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Basic
  • Last Updated : 21 Jun, 2022

Typography is a feature of Bootstrap for styling and formatting the text content. It is used to create customized headings, inline subheadings, lists, paragraphs, aligning, adding more design-oriented font styles, and much more. Bootstrap support global settings for the font stack, Headings and Link styles to be used in the web app for every type of OS and Device to deliver the best user interface.

Typography can be used to create: 

  • Headings
  • Subheadings
  • Text and Paragraph font color, font type, and alignment
  • Lists
  • Other inline elements

Some classes and Tags to implement the typography feature of bootstrap: 

   

  • h1 – h6: To match the font styling of a heading but cannot use the associated HTML element.
  • text-muted: It is used for text color, text-muted fades the text. i.e. text greyed out.
  • display: It is used to create better headings.
  • lead: It is used to make a paragraph stand out i.e. Visually better.
  • mark: It is used to highlight the text.
  • small: It is used to create secondary subheadings.
  • initialism: It is used to render abbreviations in slightly small text size.
  • blockquote: It is used to quote content.
  • blockquote-footer: It is the footer details for identifying the source of the Quote.
  • text-center: It is used to align the text to the center.
  • list-inline: It is used to make the element of the list inline.
  • text-truncate: It is used to shorten the longer text by truncating with an ellipsis.
  • text-uppercase: It is used to transform text to uppercase.
  • text-lowercase: It is used to transform text to lowercase.
  • text-capitalize: It is used to transform text to capitalize the first letter of each word leaving other letters in lowercase.
  • pre-scrollable: Makes a <pre> element scrollable
  • dl-horizontal: Lines up the terms(<dt>) and descriptions (<dd>) elements side-by-side.
  • list-unstyled: the default list-style and left margin on list items are removed.
  • text-right: Depicts right-aligned text.
  • text-left: Depicts left-aligned text.

 

Example 1: To illustrate the h1-h6 classes.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Text-muted
    </title>
</head>
<body>
     
 
<p class="h1">h1. Bootstrap heading</p>
 
<p class="h2">h2. Bootstrap heading</p>
 
<p class="h3">h3. Bootstrap heading</p>
 
<p class="h4">h4. Bootstrap heading</p>
 
<p class="h5">h5. Bootstrap heading</p>
 
<p class="h6">h6. Bootstrap heading</p>
 
 
 
 
 
</body>
</html>


Output:

 

 

Example 2: To illustrate the text-muted class.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Text-muted
    </title>
</head>
<body>
     
 
 
<p>GeeksforGeeks //A Normal Text.</p>
 
 
 
    <p class="text-muted">GeeksforGeeks //A Muted Text.</p>
 
 
 
</body>
</html>


Output:

Example 3: To illustrate the display class.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Display
    </title>
</head>
<body>
    <h3>GeeksforGeeks</h3>
    <h3 class="display-3">GeeksforGeeks</h3>
</body>
</html>


Output:

Example 4: To illustrate the lead class.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Lead
    </title>
</head>
<body>
     
 
 
<p>GeeksforGeeks - Normal Paragraph</p>
 
 
 
    <p class="lead">GeeksforGeeks - Lead Paragraph</p>
 
 
 
</body>
</html>


Output:

Example 5: To illustrate the mark tag.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Mark
    </title>
</head>
<body>
     
 
 
<p>GeeksforGeeks - Normal</p>
 
 
 
    <mark>GeeksforGeeks - Highlighted</mark>
</body>
</html>


Output:

Example 6: To illustrate the small tag.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Small
    </title>
</head>
<body>
    <h2 class="text-success">GeeksforGeeks
        <small>A CS Portal </small>
    </h2>
</body>
</html>


Output:

Example 7: To illustrate the initialism class.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Initialism
    </title>
</head>
<body>
    <abbr title="GeeksforGeeks"
        class="text-success initialism">
        GfG</abbr> is a CS portal
</body>
</html>


Output:

Example 8: To illustrate the blockquote tag and blockquote-footer class.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Blockquote and Blockquote footer
    </title>
    <style>
        blockquote {
            font-size: 30px;
            color: green;
        }
    </style>
</head>
<body>
    <blockquote>GeeksforGeeks</blockquote>
    <blockquote class="blockquote-footer">
        a CS portal
    </blockquote>
</body>
</html>


Output:

class=”alignnone size-medium wp-image-844239″/>
Example 9: To illustrate the text-center class.

HTML




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href=
        integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
        crossorigin="anonymous">
    <title>
        Text-Center
    </title>
    <style>
        p {
            color: green;
        }
    </style>
</head>
<body>
    <p class="display-4 text-center">GeeksforGeeks</p>
 
 
 
</body>
</html>


Output:

Supported Browser:

  • Google Chrome
  • Microsoft Edge
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!