Class
- The class is used to assign one or more class names to an HTML element or tag.
- These class names are used to apply CSS styles or JavaScript functionality to specific elements, allowing you to target and style them in a consistent and organized manner.
Key Points:
- Class names are case-sensitive.
- It can be used in any tag.
- There should be many classes of the same name.
- There should be many classes on a single webpage.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Class</title>
<style>
.highlight {
background-color: beige;
color: rgb(203, 32, 9);
}
</style>
</head>
<body>
<p class="highlight">This is a paragraph with a custom class applied.</p>
</body>
</html>
Output: