CSS TUTORIAL : Selector in CSS

 


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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> CSS Selectors</title>
    <style>
        /* element selector */
        p {
            border1px solid;
        }

        /* color selector for all paragraph  */
        p {
            colorblue;
        }

        /* Id Selector */
        #pink {
            colorpink;
            background-colorblack;
        }

        /* Id selector */
        #red {
            colorred;
            backgroundyellow;
        }

        /* Id selector */
        #green {
            colorwhite;
            background-colorred;
        }

        /* Grouping selector */
        footer,
        span {
            colorred;
            background-coloryellow;
        }

        /* class selector */
        .bgorange {
            colororange;
            background-colorblack;
        }
    </style>
</head>
<!-- Id is used for specific thing but class is used for multiple thing -->
<body>
    <h3> CSS Selector</h3>
    <p id="pink"> This is a simple paragraph to demonstrate css selectors</p>
    <p id="red"> This is another simple paragraph to demonstrate css selectors</p>
    <p id="green"> This is yet another simple paragraph inside div to demonstrate css selectors</p>
    <p id="orange" class="bgorange"> This is again another paragraph</p>
    <span>this is a span</span>
    <footer>this is a footer</footer>
</body>
</html>