CSS code for pseudo classes

 <!DOCTYPE html>

<html>

    <head>

        <title>Page Title</title>

        <style>

            #parent p:first-child{

    color: green;

    text-decoration: underline;

}

#parent p:last-child{

    color: blue;

    text-decoration: underline;

}

        </style>

    </head>

    <body>

        <div id="parent">

            <p>first paragraph</p>

            <p>second paragraph</p>

            <p>third paragraph</p>

            <p>fourth paragraph</p>

        </div>

    </body>

</html>


OUTPUT




Comments