HTML Classes
CSS Classes
HTML classes are basically used for applying CSS in HTML,We can apply CSS classes with class attribute with HTML elements
CSS Class Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
.city{ Color : black }
</style>
</head>
<body>
<div class="city">
<h2>Delhi</h2>
<p>Delhi is the capital of India.</p>
</div>
</body>
</html>
<html>
<head>
<title>Page Title</title>
<style>
.city{ Color : black }
</style>
</head>
<body>
<div class="city">
<h2>Delhi</h2>
<p>Delhi is the capital of India.</p>
</div>
</body>
</html>
Some Points to Remember
1. Multiple classes can we applied to a single element2. One class can we be applied to multiple elements
3. Class name is case sensitive
4. These class name can we used in javascript to access the elements
HTML IDs
Id attribute in Elements defines the Unique element
CSS Class Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1 id="myHeader">My Header</h1>
</body>
</html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1 id="myHeader">My Header</h1>
</body>
</html>