How Can I Set Font Weight For HTML P Element In CSS

admin_img Posted By Bajarangi soft , Posted On 02-11-2020

In CSS The font-weight property specifies the weight of a font.So today we discuss how to do it.

How Can I Set Font Weight For HTML P Element In CSS

Step 1: Create index.html file and implement as below code in it.

<p class="normal">This is a paragraph.</p>
<p class="light">This is a paragraph.</p>
<p class="thick">This is a paragraph.</p>
<p class="thicker">This is a paragraph.</p>

Step 2: Implement CSS code as below to Font Weight.

<style>
    body {
        background: #2e9ad0;
    }

    p.normal {
        font-weight: normal;
    }

    p.light {
        font-weight: lighter;
    }

    p.thick {
        font-weight: bold;
    }

    p.thicker {
        font-weight: 900;
    }
</style>

Complete Code For Setting Font Weight For HTML P Element In CSS.

<!DOCTYPE html>
<html>
<head>
    <title>How Can I Set Font Weight For HTML P Element In CSS</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<style>
    body {
        background: #2e9ad0;
    }

    p.normal {
        font-weight: normal;
    }

    p.light {
        font-weight: lighter;
    }

    p.thick {
        font-weight: bold;
    }

    p.thicker {
        font-weight: 900;
    }
</style>
<body>
<br/><br/>
<div class="container">
    <br><br><br>
    <div class="text-center">
        <h1 id="color" style="color: white;">Set Font Weight For HTML P Element In CSS</h1>
    </div>
    <br>
    <div class="well">
        <p class="normal">This is a paragraph.</p>
        <p class="light">This is a paragraph.</p>
        <p class="thick">This is a paragraph.</p>
        <p class="thicker">This is a paragraph.</p>
    </div>
    <br>
</div>
</body>
</html>

Related Post