Open In App

Bootstrap 5 Text Font weight and italics

Bootstrap 5 Text Font weight and italics classes are used to manipulate text weight and text style. There are several classes to do so. In this article, we will see the use of each class that has been used in the examples code.

Font weight and italics classes:



Syntax:

<tag class="fw-*">...</tag>

Example 1: In this example, we will use font-weight classes to check the different text weights.






<!DOCTYPE html>
<html>
 
<head>
        rel="stylesheet"
        integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
        crossorigin="anonymous">
</head>
 
<body>
    <div class="container">
        <h1 class="text-success text-center">
            Geeksforgeeks
        </h1>
        <p class="text-center">Geeks Learning Together</p>
 
        <!-- Bootstrap Font weight classes used -->
        <u>Font-weight: bold</u>
        <p class="fw-bold">
            A Computer Science Portal for Geeks
        </p>
        <u>Font-weight:bolder</u>
        <p class="fw-bolder">
            A Computer Science Portal for Geeks
        </p>
        <u>Font-weight:normal</u>
        <p class="fw-normal">
            A Computer Science Portal for Geeks</p>
        <u>Font-weight:light</u>
        <p class="fw-light">
            A Computer Science Portal for Geeks
        </p>
        <u>Font-weight:lighter</u>
        <p class="fw-lighter">
            A Computer Science Portal for Geeks
        </p>
    </div>
</body>
 
</html>

Output:

Bootstrap 5 Text Font weight and italics

Example 2: In this example, we will use different font-style to manipulate the text style.




<!DOCTYPE html>
<html>
  
<head>
    <link href=
          rel="stylesheet"
          integrity=
"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
          crossorigin="anonymous">
</head>
 
<body>
    <div class="container">
        <h1 class="text-success text-center">
            Geeksforgeeks
        </h1>
        <p class="text-center">Geeks Learning Together</p>
        <!-- Bootstrap Font style classes used -->
        <u>Font-style:italic</u>
        <p class="fst-italic">
            A Computer Science Portal for Geeks
        </p>
        <u>Font-style:normal</u>
        <p class="fst-normal">
            A Computer Science Portal for Geeks
        </p>
    </div>
</body>
 
</html>

Output:

Bootstrap 5 Text Font weight and italics

Reference: https://getbootstrap.com/docs/5.0/utilities/text/#font-weight-and-italics


Article Tags :