Characteristics and differences within a line of HTML elements block elements, the block-level element row

element

Element refers to all HTML tags from the tag start (start tag) to the end tag (end tag) of.

Element classification

HTML element classification can be divided into elements, three kinds of block elements within block element row and the rows, the three converted into each other can be achieved by setting the display attribute value. Achieve the following

#转换为行内元素
display:inline;

#转换为块状元素
display:block;

#转换为行内块状元素
display:inline-block;

Features elements

Row element
  • Will not wrap
  • Set the width and height invalid
  • Invalid setting margin in the vertical direction, left and right direction of the effective
  • Vertical and horizontal directions is provided padding are valid

Have common elements: span, a, b, br, u, ur the like

Inline block elements
  • Will not wrap
  • Width and height can be identified
  • Default arrangement from left to right

There are common elements: img, input, td, etc.

Massive element
  • Wrap
  • Width and height can be identified
  • Right and left upper and lower margin and padding are valid
  • A plurality of block elements together write tags, the default arrangement from top to bottom

There are common elements: div, p, ul, ol, li, h1, h2, etc.

Guess you like

Origin www.cnblogs.com/paul666/p/11089103.html