How to use CSS to define a specific style to HTML elements by adding class attribute to elements

1 Answer

0 votes
<!DOCTYPE html>
<html>
    <head>
        <style>
            p {
                border: 1px solid lightgray;
                margin: 30px;
            }
            p.pclass {
                color: green;
            }
        </style>
    </head>
    <body>

        <p class="pclass">Text text text</p>
        <p>Text text text</p>
        <p class="pclass">Text text text</p>

    </body>
</html>

 



answered Dec 7, 2018 by avibootz
...