Ask coding questions

← Back to all posts
Whats the difference?
NotInnit (3)

What's the difference between

#orange-text {
color: orange;
}

and

.orange-text {
color: orange;
}

Answered by SixBeeps (5223) [earned 5 cycles]
View Answer
Comments
hotnewtop
SixBeeps (5223)

One of them applies the color to the element with the orange-text ID, and the other one applies it to the elements with the orange-text class. IDs are used for single important elements, and classes are for referencing multiple similar elements.

MikeJMS8910 (231)

When you have a # in front of the name that means that it is going to look for an element with the id of orange-text but when you have a . in front of the name that means that it is going to look for the class of orange-text.