Sergey Mell
Sergey Mell

Reputation: 8050

Input is a self closing tag. Or not?

As we know input is a self-closing tag. I thought the same.

However, a while ago I read Web Fundamentals about Semantics and accessibility tree and found such an interesting example:

<label>
  <input type="checkbox">Receive promotional offers?</input>
</label>

This example doesn't meet the html5 validator requirements and seems not valid however I used to trust Google developers.

Is this a correct syntax? Some upcoming standards or a simple typo?

Upvotes: 2

Views: 1754

Answers (1)

Dai
Dai

Reputation: 155648

The HTML5 "Living specification" at the time of writing (2020-01-02) says that the input element has a "Nothing" content-model, which means it cannot contain content. So Google's documentation is wrong.

Upvotes: 3

Related Questions