More on CSS Selectors

 <!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>More on selectors</title>

    <style>

        h1{

            background-color: red;

            color: black;

            font-weight: bold;

            text-align: center;

        }

        body{

            background-color: rgb(97, 92, 97);

        }

        /* if p is contained by any li which is contained by div  */

        /* div li p{

            color: rgb(255, 255, 255);

            background-color: green;

            font-weight: bold;

            text-align: center;

        }

        if p is right inside div then this css will be applied 

        div > p{

            color: rgb(255, 255, 255);

            background-color: green;

            font-weight: bold;

            text-align: center; 

        } */

        /* if p is right after div i.e, p is the next sibling of div  */

        /* div + p{

            color: white;

            background-color: rgb(172, 18, 18);



        } */

    </style>

</head>

<body>

    <h1>This is more on selectors</h1>

    <div class="container">

        <div class="row">

            <ul>

                <li class="item"><p>This is another paragraph inside it</p></li>

                <p>This will not get affected</p>

            </ul>

            <p>This is a paragraph</p>

        </div>

        <p>This is another paragraph</p>

    </div>

    <p>This is outermost paragraph</p>

</body>

</html>

Comments

Popular posts from this blog

Transform Property In CSS