We have the technology: specifying a second rule, just for the <h1>
We don’t have to split the “h1, h2” rule up, we just need to add another rule that is only for “h1” and add the border style to it.
Another test drive...
Change your CSS and reload the page. You’ll see that the new rule added a black border to the bottom of the main heading, which gives us a nice underline on the heading and really makes it stand out.
There are no Dumb Questions
Q:
Q: So how does that work when you have more than one rule for an element?
A:
A: You can have as many rules as you want for an element. Each rule adds to the style information of the rule before it. In general, you try to group together all the common styles between elements, like we did with <h1> and <h2>, and then any style that is specific to an element, you write in another rule, like we did with the border-bottom style for the main heading.
You are currently reading a PREVIEW of this book.
Get instant access to over
$1 million worth of books and videos.