CSS3 > Texts

Text Color in CSS3

How to set the text-color for different elements in CSS3?


By using color property we can set the text-color for different elements. Color property specifies the color of the text.

 <style>
        p {
            color: green;
        }

        div {
            color: orange;
        }

        body {
            color: blue;
        }

        .class {
            color: violet;
        }
</style>

<body>
    <p>This is 'P' element.</p>
    <br />
    <div>
        This is 'DIV' element.
    </div>
    <br />
    <b>This is BOLD content.</b>
    <form class="class">
        Enter Name<input type="text" />
    </form>
</body>

In the above code snippet, we have given direct color to the <p> element, <div> element, <b> element and for the <form> element color is given with the .class selector.

OUTPUT

 Views: 3696 | Post Order: 40



Write for us






Hosting Recommendations