Elements in the line (non-exclusive line):
a,button,big,small,datalist,em , i, input,mark,span,progress,s,strong,b,sub,sup,textarea u
(The basic elements related to text are inline elements)
Inline element features:
- Non-monopoly party
- Arrangement: from left to right
- Usually use inline elements to build text, small icons, and small structures
- Setting the width and height does not work. If you want to set the width and height, you need to convert it to a block-level element/inline-block element: display:block/display:inline-block
- When the width and height are not set: the width and height of its own content is its width and height
- Naturally comes with display:inline attribute
- Block-level elements cannot be nested within inline elements (except for special a tags)
- A tag cannot be nested within a tag. Even if we do, the browser will resolve it to a parallel relationship instead of a nested relationship.
Block-level element (on its own line):
table,form,dl,dt,dd,figure,figcaption,div,h1~h6,hr,ul,ol,li,nav,p,
Block-level element features:
- Exclusive party
- Arrangement: from top to bottom
- Usually block-level elements are used for structural building
- You can set the width and height and other properties of the box model
- If the width and height are not set, its width is the width of the parent element, and its height is the height of its own content
- Naturally comes with display:block;
- Block-level elements can nest inline elements
- ul , ol , below can only be li dl below can only be dt, dd
- No block-level elements can be nested within the p element, including inline elements that can itself be nested
Inline block elements (born with display:inline-block):
img ,input