Reference: The nesting rules of tags in HTML
1. HTML tags:
- Block element (block):
- 常用:div、p、ul、ol、li、dl、dt、dd、fieldset、form、h1~h6、hr、table
- Not commonly used: address, isindex, menu, noframes, noscript, pre, blockquote, center, dir
- Inline elements (inline)
- 常用:span、a、b、strong、i、em、label、textarea、small、img、input
- 不常用:abbr、acronym、bdo、big、br、cite、code、dfn、font、kbd、q、s、samp、select、strike、sub、sup、tt、u、var
2. Nesting rules
- Block elements can contain inline elements or some block elements, but inline elements cannot contain block elements, it can only contain other inline elements;
- There are several special block-level elements that can only contain embedded elements, and can no longer contain block-level elements. These special tags are: h1, h2, h3, h4, h5, h6, p, dt
- li can contain div tags;
- Block-level elements are juxtaposed with block-level elements, and embedded elements are juxtaposed with embedded elements;
3. Put the input tag in the a tag
The input tag can be placed in the a tag. But there will be some problems