Class vs ID

We can target any HTML element using a Class or an ID. What's the difference between them? Let's find out

Published on

Monday, Apr 13, 2020

There will be time when you want to target a particular element for the css or js. In this lecture we will learn how to target an element with a class and an ID.

We will also learn the actual difference between them.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML COURSE</title>
  </head>
  <body>
    <h1 class="heading">a class called heading is targeting me :)</h1>
    <span id="content">I am being targeted via an ID</span>
  </body>
</html>

I hope you will like it. If you face any issue or have any doubt please connect with me via facebook messenger chat floating on the right side of the screen :)

happy learning :)

Follow me on Instagram