Divs & Spans

Divs

  • Divs allow you to group a set of elements together in one block-level box

JS Bin on jsbin.com

  • Divs are mainly used to break your content up into logical sections. By doing so, you have more control of the layout and appearance of your pages.

Spans

  • Spans are the inline equivalent to Divs

  • Spans are used to either:

    • contain a section of text where there is no other suitable element to differentiate it from its surrounding text

    • contain a number of inline elements

  • most common reason why people use elements is so that they can control the appearance of the content of these elements using CSS

JS Bin on jsbin.com

This example uses classes and css, we will cover these topics later in the course