HTML and CSS Reference
In-Depth Information
Let's put a line under the welcome message too
Let's touch up the welcome heading a bit more. How about a line under it? That
should set the main heading apart visually and add a nice touch. Here's the
property we'll use to do that:
border-bottom: 1px solid black;
The trouble is, if we add this property and value to the combined
h1, h2
rule in our CSS, we'll end up with borders on both our headings:
Here
we'r
e add
ing a
prop
erty
h1, h2 {
font-family: sans-serif;
color: gray;
border-bottom: 1px solid black;
}
to c
hange
the
bott
om bo
rder
for
both
the <
h1>
and <
h2>
elem
ents.
p {
color: maroon;
}
So, how can we set the bottom border
on just the
<h1>
element, without
affecting the
<h2>
element? Do we have
to split up the rules again? Turn the
page to find out…