Filter (Advanced Search)
Downloads
0
Views
210
Video

Video is not available... Embedded is previous playlist.

Details

Different HTML elements can point to the same class name.

In the following example, both <h2> and <p> point to the "city" class and will share the same style:


<!DOCTYPE html>
<html>
<head>
<title>Two elements - one class</title>
<style>
.school {background-color: tomato;color: white;padding: 10px;}
</style>
</head>
<body>
<h2>Different Elements Can Share Same Class</h2>
<p>Even if the two elements do not have the same tag name, they can both point to the same class, and get the same CSS styling:</p>

<h2 class="school">GSSS KHOKHAR</h2>
<p class="school">GOVT.SEN.SEC.SCHOOL, KHOKHAR</p>

</body>
</html>



Ad