Logo
HTMLCSSJavaScriptReactjsnewContactUpdates

Get started today

HTMLCSSJavaScriptReactjsnewContactUpdates

Tools

Resume BuilderQR GeneratorVS Code Editor

Connect

GitHubWhatsApp Channel
div and span
details and summary tag

HTML Class and Id

By Saket Bhatnagar•June 14, 2025•Beginner to Intermediate

Table of Contents

  1. class and id

class and id

  1. 1class and id both are attributes in HTML and are used to target the elements in a web page.
  2. 2'class' is used to target multiple elements whereas 'id' is used to uniquely identify the element.
  3. 3One element can have multiple classes whereas one element should have only one id.
  4. 4We can apply same class to multiple elements whereas id should be unique in a webpage and should not be applied to multiple elements.
  5. 5Sytax :- class = 'c1, c2,c3,-----,cn' whereas id = 'id1'

Share this article

Last updated: July 14, 2025

Join Our Community

Login to Join

© 2025 Saket Bhatnagar. All rights reserved.

    ☕