Selectors in CSS

 <!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>CSS Selectors</title>

    <style>

        /* Element Selector */

        p{

            border: 2px solid red;

        }

        /* Id Selector */

        #firstPara{

            color:green;

        }

        /* Class selector */

        .bgBlue{

            color: orange;

            background-color: blue;

        }

        /* Grouping Selector */

        footer,span{

            background-color: pink;

        }

    </style>

</head>

<body>

    <!-- we will use # for id and . for class  -->

    <h3>CSS Selectors</h3>

    <p id="firstPara">This is a simple paragraph to demonstrate css selectors</p>

    <p id="secondPara" class="redElement bgBlue">This is another simple paragraph to demonstrate css selectors</p>

    <div>

        <p>This is yet another simple paragraph inside div to demonstrate css selectors

        </p>

        <span>This is span</span>

    </div>

    <footer>This is footer</footer>

</body>

</html>

Comments

Popular posts from this blog

Transform Property In CSS

More on CSS Selectors