Questions tagged [html-heading]

In HTML, the

,

,...

tags define headings of different levels,

being the highest. Browsers typically apply preset top and bottom margins as well as different font sizes and weights to headings.

The headings elements from <h1> to <h6> represent six levels of element headings, where <h1> is the highest s level and <h6> is the lowest level.

Usage notes

  • Heading information can be used by user agents to construct a table of contents for a document automatically.
  • Avoid using heading elements to resize text. Instead, use the CSS font-size property.
  • Avoid skipping heading levels: always start from <h1>, followed by <h2> and so on.
  • Use only one <h1> per page or view. It should concisely describe the overall purpose of the content.
  • Using more than one <h1> will not result in an error, but is not considered a best practice. It is beneficial for screen reader users, and SEO.
  • While HTML5 allows a <h1> per sectioning element, it is not considered best practice, and may subvert the expectations of how screen reader users navigate.
250 questions
10
votes
5 answers

Best practice when displaying inline HTML elements next to a h1 element?

I have a webpage that displays the name of a "product", with edit/delete links next to it on the same line. Example: Product 1 (Edit | Delete) I want the product name to have a large font size, and the edit/delete buttons to have regular font size…
XåpplI'-I0llwlg'I -
  • 21,649
  • 28
  • 102
  • 151
9
votes
2 answers

Is it valid to put h3 (or any heading) inside td tags?

The question is asked for TH tags, but I couldn't find one for TD tags. Can I put headings inside tags?
jeff
  • 13,055
  • 29
  • 78
  • 136
9
votes
3 answers

Proper way to use h1? (Regarding document outline and SEO)

I'm still trying to familiarize myself with HTML5, and there's this stuff which feels a bit confusing.... I once read in Jeremy Keith's book and HTML5 Doctor (via this question) which say that HTML5 makes it possible to use multiple h1s. In HTML5,…
deathlock
  • 2,756
  • 5
  • 27
  • 48
8
votes
0 answers

How to use heading elements within a custom element?

Per this issue with the W3C html spec, using nested sections with multiple h1's is discouraged because no browsers implement the outline algorithm needed to make them work semantically. However, if I have a custom element that needs to use a heading…
grunet
  • 311
  • 2
  • 9
8
votes
5 answers

Automatic Numbering of Headings H1-H6 using jQuery

I read related posts, but didn't find a solution for IE, so I ask for a jQuery-solution for this problem: I've some nested hierarchical Headings like this

heading 1

subheading 1

heading 2

subheading 1

cukabeka
  • 530
  • 2
  • 9
  • 22
8
votes
2 answers

How to target headings for a specific div ID?

I am trying to style all the headings in my header with a different font-family than the headings on the rest of the page but I am having trouble getting the style to only apply to the specific header ID. Here is what I tried: #header h1,h2,h3,h4 { …
user3101431
  • 407
  • 2
  • 8
  • 15
8
votes
1 answer

Style heading tags with css reset

After using a css reset, all my heading tags are reset (ofcourse). What is the best way to style them like normal. Surely there is better way then this? h1 { font-size: 2em; } h2 { font-size: 1.5em; } h3 { font-size: 1.3em; } h4 { font-size: 1em;…
Jeremy
  • 89
  • 1
  • 2
8
votes
2 answers

Select all the h tag inside a class

Instead of writing the CSS code like, .dark h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6 { } Is there any short way to this like [class*="blah"]? Regards.
Body
  • 3,608
  • 8
  • 42
  • 50
6
votes
6 answers

Should I use multiple h1 or multiple h2 without h1?

In a web page that shows a list of tutors, the current HTML codes:

Tutors

John

...

Mary

...

bobo
  • 8,439
  • 11
  • 57
  • 81
6
votes
1 answer

Which heading level to use when position in document outline is unknowable?

I'm building an HTML snippet that will be dynamically included on a page. The snippet looks something like this:

Title

Content

The problem is that I have no way of knowing where in the document outline…
jcolton
  • 193
  • 7
6
votes
1 answer

HTML5 subtitle mark-up for every level of headings, ie, h1 to h6

Including WordPress official templates, there are a lot of resources explaining how to code "h1" and "h2" wrapping with "header" tag to include a subtitle as "p" tag. For example,

The Title For The Site

Ninki
  • 93
  • 2
  • 8
6
votes
1 answer

Float "edit" link to right of Heading (must keep heading tag block)

Given the following html

Test Heading

edit

Lorem ipsum…

Michael
  • 1,133
  • 3
  • 15
  • 30
6
votes
4 answers

Regex for replacing

with

tag?

I need to replace all:

content

with

content

in a string of content. Basically i just want to replace the "p" with a "h2". This is what i have so…
qwerty
  • 5,166
  • 17
  • 56
  • 77

5
votes
2 answers

CSS selector for first heading of the highest level?

How can I select the first of the highest h* elements present in a DOM? Something like (h1, h2, h3, h4, h5, h6):first-of-ordered-set I.e. if a DOM tree has, in this order, h2, h3, h1, h2, h1, it would select the first h1; and if the DOM has h3, h3,…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
5
votes
5 answers

Do html headers always have to count up from 1?

I'm talking about proper semantic mark-up. I know normally there's no reason not to start at h1 and work your way down from there. But, if I am building something like a sidebar that has its own somewhat separate hierarchy, what is the best…
Damon
  • 10,493
  • 16
  • 86
  • 144
1
2
3
16 17