Are H1,H2,H3,H4 tags block or inline elements?

后端 未结 7 939
暗喜
暗喜 2020-12-06 08:52

Is it correct HTML to change the color of text inside a H1, H2, H3 or H4 element? Are they block level?

For example

7条回答
  •  天涯浪人
    2020-12-06 09:38

    Yes, a span within a h1 tag is allowed. As you can see on the W3C Reference page for the h1 tag:

    Permitted contents: phrasing content

    And phrasing content is normal text as well as your span element (and several other elements as can be seen on this reference page for phrasing content.

    Oh yeah, and the heading tags are block elements.

提交回复
热议问题