HTML and CSS Reference
In-Depth Information
We have the technology: specifying a
second rule, just for the h1
We don't have to split up the h1, h2 rule, we just need to add another
rule that is only for h1 and add the border style to it.
Th e fir st ru le sta ys th e sam e. W e're
st ill goi ng to use a com bined rule
h1, h2 {
font-family: sans-serif;
color: gray;
}
fo r the font -fam ily a nd co lor f or
bo th < h1> a nd <h 2>.
h1 {
border-bottom: 1px solid black;
}
p {
color: maroon;
}
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.
Her e's t he
bot tom bor der
in b lack .
And no border
here—just what
we wanted.
Search WWH ::




Custom Search