Allow Div Elements In H1, H2, H3, H4, H5, H6 Elements #6503 - GitHub

Skip to content Dismiss alert {{ message }} / html Public
  • Notifications You must be signed in to change notification settings
  • Fork 3.1k
  • Star 9.2k
  • Code
  • Issues 2.3k
  • Pull requests 237
  • Actions
  • Wiki
  • Security
  • Insights
Additional navigation options Allow div elements in h1, h2, h3, h4, h5, h6 elements #6503New issueNew issueClosedClosedAllow div elements in h1, h2, h3, h4, h5, h6 elements#6503@anneke

Description

@annekeannekeopened on Mar 17, 2021

Hello!

I've been having a discussion with colleagues about using div elements in h-elements (h1, h2, h3...), when it makes sense to style parts of the header differently, even though the content belongs together (and should not, for good reasons, become two seperate h-elements). Here is an example.

<h2> <div>Beans are disgusting</div> <div>This is why we forbid beans</div> </h2>

I have just learned that a span within a h-element is allowed:

<h2> <span>Beans are disgusting</span> <span>This is why we forbid beans</span> </h2>

But, to force a line break between the two, I would either have to add a <br /> or display: block to the span elements, and that feels counter-intuitive when there is a working solution already that makes those things unnecessary.

I would love to hear the reasons why example A is not allowed, and why example B is! :-) And/or, if this can be discussed to make a change in the spec.

Addendum: I got linked info about the hgroup element, which is great, but I understand it is not yet supported by assistive technology, which is why I wanted to do this in the first place. (sadface)

With the highest regards, Anneke

Metadata

Metadata

Assignees

No one assigned

Labels

No labelsNo labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You can’t perform that action at this time.

Từ khóa » H1 H2 H3 Div