CSS3 > Selectors

Class selector in CSS3

How to apply style to any element using the class attribute in CSS3?


Class is used to apply css style to any element using the class attribute.

<style>
        .myClass {
            background-color: Fuchsia;
            border: 1px solid #c0c0c0;
        }
</style>
    
<body>
        <div>This is text inside the DIV</div>
        <p class="myClass">This is some text.</p>
        <b>This is the BOLD text</b>
</body>

In the above code snippet we can notice that <p> tag includes the Class attribute.

OUTPUT

 Views: 3588 | Post Order: 4



Write for us






Hosting Recommendations