How can I group H1-H6 in CSS?

Can CSS style be applied to all headers from H1 to H6?

+4
source share
4 answers

If you mean that you need a CSS selector that is designed for all title elements, then no. You must specify each tag name.

Example:

h1, h2, h3, h4, h5, h6 { margin: 5px 0; font-weight: bold; } 
+14
source
 h1,h2,h3,h4,h5,h6 { color: #F00; } 
+6
source

you can do it with css. use the following:

 h1, h2, h3, h4, h5, h6 { color:red; /* and the rest of your styles */ } 

see http://www.w3schools.com/css/css_intro.asp for a good tutorial

+3
source

It seems like not following the convention at least in firefox

 aside h2 { text-align: center; } 

will only affect h2, which is a child aside

 aside h1,h2,h3,h4,h5,h6 { text-align: center; } 

seems to affect all headlines regardless of whether the child is on the sidelines.

Firefox has a bug or CSS is not very logical in its syntax.

-one
source

All Articles