Code style
A few notes about code style.
Over-specific CSS selectors
You might see CSS examples in our textbook written like this:
p.intro {
color: #f00;
}
The selector is p.intro
. Do you see how the p
element is part of the selector?
Don’t do that. This was a popular practice, but it’s become less common in the last few years. These styles are more specific than they need to be, so the browser will give them higher priority and it’ll be hard to know how they interact with other styles. There’s also a tiny performance hit.
Instead, just write:
.intro {
color: #f00;
}
Your life will be simpler.