amphibient
amphibient

Reputation: 31338

Style class superior to all headings (h1-h6)

Is there a way (a class superior to all Hs, 1-6) to set a property shared among all Hs so that you don't have to put it in each one manually? E.g. if I wanted to have an underline at the bottom of each H, I would do

border-bottom:1px solid #999;

Now I have to put it in each one separately whereas the property is the same.

I tried to do

h { border-bottom:1px solid #999; }

but it didn't work.

What I am actually doing is:

.main-heading
{
    border-bottom:1px solid #999;
}

and then

<h3 class="main-heading">My Heading</h3>

and that works but I would rather not use a class with an H tag since it will always be the same (simplicity).

Upvotes: 0

Views: 208

Answers (2)

Blender
Blender

Reputation: 298512

Not really. You can just write a selector that matches all of them:

h1, h2, h3, h4, h5, h6 {
    border-bottom:1px solid #999;
}

Upvotes: 1

Felypp Oliveira
Felypp Oliveira

Reputation: 2197

You can do like this:

h1, h2, h3, h4, h5, h6 { border-bottom:1px solid #999; }

Upvotes: 3

Related Questions