H O M E
A b o u t
My Learning Plan
EQ n IQ
JS Fundamentals
Problem Solving
Neuroplasticity n Growth Mindset
Foundations reflection

Classes n Ids in CSS/HTML


What is class attribute ?


The HTML class attribute specifies one or more class names for an element, the different HTML elements can apply the same class name, and it can be used on any HTML element.

* For example:

* The syntax for class: write a period (.), followed by a class name. Then, define the CSS properties within curly braces {}.


What is id attribute ?


The id attribute is used to specify a unique id for an HTML element, The value of the id attribute must be unique within the HTML document.

* For example:

* The syntax for id: write a hash character (#), followed by an id name. Then, define the CSS properties within curly braces {}.


ClASS vs. ID :


Id has a higher specificity than class so if both are applied to the same element and have conflicting styles, the styles of the id will be applied.