What would be a situation where someone would want to use something like
p.red { }
vs
.red {}
?
- Envato Staff
- Has been a member for 4-5 years
- Attended a Community Meetup
- Australia
- Beta Tester
- Contributed a Blog Post
- Contributed a Tutorial to a Tuts+ Site
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 5 000 and 10 000 dollars
When you only want to select paragraphs with the red class vs selecting all elements with the red class. It’s just a matter of being more specific in your selection.
Well you could be using ”.red” throughout the site but would like your paragraphs to look a little different than the rest. “p.red” is more precise and will only target a paragraph tag with the class of “red”.
.red {color: red}
p.red {color: #aa0101}
p.red is being SPECIFIC , it means only things inside the red class IN the p tag
however..
.red means anything which has a class of red
Already well answered.
Couldn’t have said it better. 
