CSS Display - Block and Inline Elements, or float

1. A block element is an element that takes up the full width available, and has a line break before and after it.

Examples of block elements:

  • <h1>
  • <p>
  • <div>

2. An inline element only takes up as much width as necessary, and does not force line breaks.

Examples of inline elements:

  • <span>
  • <a>

http://www.w3schools.com/css/css_display_visibility.asp

 

3. float will keep elements as close as possible. For example: float:left would put one element just after another element, with no space between. Even if the element is a block element.

你可能感兴趣的:(element)