The CSS id selector uses the id attribute of an HTML element to select a specific element.

Example :

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Id Selector</title>
    <style>
        #line {
            background-color: yellow;
            color: red;
            font-weight: bold;
        }
    </style>
</head>

<body>
    <h1>Id Selector</h1>
    <p id="line">Bio-Data</p>
    <!-- Yes, Formatting apply here. -->
    Name: OnWeb Sharma G <br>
    Class: PGDCA <br>
    Subject: Computer Application <br>
    <p id="line">Address: Mainpuri, Uttar Pradesh.</p>
    <!-- Yes, Formatting apply here. -->
</body>

</html>

Show Output :

CSS 03 Id Sel Image

Leave a Comment