h1 tag smaller than h2, all insde a section tag

前端 未结 1 1792
天涯浪人
天涯浪人 2021-01-23 19:42

My h1 tag, which is insode a section tag, is small than an h2 tag. The h1 tag was the correct size when out side the section tag. I keep looking through my CSS page and am findi

相关标签:
1条回答
  • 2021-01-23 20:30

    If you test the situation without your style sheet, you will see that h1 inside a section element appears in a smaller font. This is caused by a browser style sheet, in browsers that support section and its suggested rendering in HTML5. The section element has been defined so that within it, an h1 element is a heading for the section, so relative to the page as a whole, it is at the 2nd level (or even at a lower level, if section elements have been nested).

    There are various opinions on the adequacy of that approach, but that’s what HTML5 drafts say and what some browsers have implemented. On the other hand, old browsers ignore such rules, so the approach is not practically robust. It is safer (and quite acceptable according to HTML5) to use h2 for section headings.

    0 讨论(0)
提交回复
热议问题