Reputation: 152727
Is it mandatory to use H2 after h1 if text is too small then can we use h4 after h1 . and is it accessible ?
Upvotes: 4
Views: 4460
Reputation: 53366
Technically you can use any combination of those.
Semantically, it's wise to use the common order. And if the font size is too small, use CSS to change that.
With the tags h1
-h6
you give a semantic meaning to a title. Where h1
is for the top level, h2
for a subdivision of h1
, h3
for a subdivision of h2
etc.
You can change the appearance by setting CSS rules, which is great because now you can separate content from layout.
Upvotes: 30
Reputation: 29745
You should always structure the document correctly, so yes it should be h2
after h1
- if the text is the wrong size, you should use CSS to style the headings to your taste.
Upvotes: 9
Reputation: 41372
h1 and h2's are pretty vital to SEO, using one h1 and mutiple h2's after is the logical thing to do.
Upvotes: -1
Reputation: 2254
No, they're just tags. The heirarchy is implied rather than defined or enforced so you can use them in any order you please.
But for readability and neatness you're better of redefining them with CSS if you don't like the sizes rather than just using H3 for a main heading and ignoring H1 and H2. Aside from anything else it could impact Search Engine Optimisation (which considers H1 significant, though I'm not sure about H2 and H3).
Upvotes: 0
Reputation: 548
H1 is usally used for primary headers, h2 for subheaders, h3 for subsubheaders etc. It's doesn't really matter what order you use them in. it's just a conventional document structure, it would illogical to have a sub header, then a primary header but it's not enforced. Just style them in css for your liking.
Upvotes: 3
Reputation: 19625
Yes, you can skip levels, and most screen readers won't care.
It is often better to use CSS, though.
Upvotes: 1
Reputation: 27499
Ideally you should stick to H1 then H2 and then use CSS to alter the styles of both to match what you want.
Think of HTML as describing the content and structure of your document (hence why it's preferred to stick to H1 then H2, because that indicates the structure of the headings), and then think of CSS as taking that structure and formatting it according to some layout rules, so the CSS defines how big and what colour your want all your H1s and H2s to be.
(Technically there is nothing stopping your from mixing up the order and doing whatever you want though)
Upvotes: 1