Class Attribute In HTML
The class is an attribute which specifies one or more
class names for an HTML element. The class name can be used by CSS and JavaScript
to do some tasks for HTML elements.
A class attribute can be define within <style>
tag or separate file using (.) character.
Example:
<!DOCTYPE
html>
<html>
<head>
<style>
.headings {
color: Tomato;
font-family: Verdana;
background-color: black;
}
</style>
</head>
<body>
<h1
class="headings">This is first Heading</h1>
<h2
class="headings">This is first Heading</h2>
<h3
class="headings">This is first Heading</h3>
<h4
class="headings">This is first Heading</h4>
</body>
</html>
|
Result:
This is first Heading
This is
first Heading
This is
first Heading
This is
first Heading
EmoticonEmoticon