Classes and IDs | HTML: Classes and IDs both are using to access the particular element in CSS or in JS.
Here is the ClassesAndIds.html:
- <!DOCTYPE html>
- <html lang="en" dir="ltr">
- <head>
- <style>
- .class {
- font-size: 20px;
- background-color: yellow;
- }
- #id001 {
- font-size: 30px;
- background-color: orange;
- }
- #id007 {
- font-size: 40px;
- background-color: lightblue;
- }
- </style>
- <title>Classes and Ids</title>
- </head>
- <body>
- <!-- Classes -->
- <div class="class">
- <h3>Class</h3>
- <p>bla bla bla</p>
- </div>
- <span class="class">bla bla bla</span>
- <!-- Ids -->
- <div id="id001">
- <h3>Id</h3>
- <p>bla bla bla</p>
- </div>
- <span id="id007">bla bla bla</span>
- </body>
- </html>
Web view of Html:
Here is the Video: