IDs and Classes in HTML
What is an ID?
- An ID is an attribute, a unique identifier assigned to only one HTML element within a page.
- It is often used for unique styling and JavaScript manipulations.
What are Classes?
- The
class
attribute lets you give the same name to multiple HTML elements. - That way, you can easily change their look or behavior all at once.
- Classes are not unique and can be assigned to multiple elements.
- They are generally used for applying the same styles or behaviors to a group of elements.
Using IDs and Classes in CSS
- Elements with IDs are selected using a hash (#) symbol before the ID.
- Elements with classes are selected using a dot (.) before the class name.
0 Comments:
Post a Comment
Do leave your comments