기본 콘텐츠로 건너뛰기

[html, css] inline vs block vs inline-block

source: http://stackoverflow.com/questions/9189810/css-display-inline-vs-inline-block
(a little bit edited after some experiment)


Inline elements:
  1. respect only left & right margins and padding, but not top & bottom
  2. cannot have a width and height set(it's only for the kind of block)
  3. allow other elements to sit to their left and right.
Block elements:
  1. force a line break before and after the block element
  2. respect top & bottom & left & right margins and paddings
  3. respect height and width
Inline-block elements:
  1. It's a hybrid of inline and block properties.
  2. (inline property) allow other elements to sit to their left and right
  3. (block property) respect top & bottom & left & right margins and paddings
  4. (block property) respect height and width

댓글