Sunday, 6 March 2022

TUT31(Advance 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>
</head>
<style>
h1{
    background-color: red;
    color: black;
    font-weight: bold;
    text-align: center;
}

/* if p is contained by any li which is contained by div */
/* div li p{
    color: yellow;
    font-weight: bold;
    background-color: green;
} */

/* if p is right inside div then this CSS will be applied */
/* div > p{
    color: yellow;
    font-weight: bold;
    background-color: green;
} */

/* if p is right after div i.e p is the next sibling of div */
/* div + p{
    color: rgb(224, 105, 105);
    background-color: rgb(235, 217, 217) ;
} */

</style>
<body>
    <h1>This is more on selectors</h1>
<div class="container">
<div class="row">
    <ul>
        <li class="item">
            <p>This is another paragraph inside li </p></li>
            <li>This will not get affected</li>
            <p>This is para inside ul</p>
    </ul>
    <p>This is a paragraph</p>
</div>
<p>This is another paragraph</p>
</div>
<p>This is outermost paragraph</p>
</body>
</html>


No comments:

Post a Comment