Monday, 25 July 2022

HTML5 class

class

The class attribute specifies one or more classnames for an element.

The class attribute is mostly used to point to a class in a style sheet. However, it can also be used by a JavaScript (via the HTML DOM) to make changes to HTML elements with a specified class.


Example

<h1 class="heading"Header </h1>

<p class="imp">Note that this is an important paragraph.</p> 

<style>

.heading {

    color: blue;

} 

.heading {

    color: blue;

}

</style>



No comments:

Post a Comment