what are the 'class' attribute in html
ReportQuestion
2 years ago 764 views
The class is an attribute which specifies one or more class names for an HTML element. The class attribute can be used on any HTML element. The class name can be used by CSS and JavaScript to perform certain tasks for elements with the specified class name.
Applies to
The class
attribute is part of the Global Attributes, and can be used on any HTML element.
Use of the class attribute in an HTML document:
<html>
<head>
<style>
h1.intro {
color: blue;
}
p.important {
color: green;
}
</style>
</head>
<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph. :)</p>
</body>
</html>
Thread Reply