| These two tags are often used inter-changeably by | | | | controls using |
| developers fordifferent reasons, so what are the | | | | JavaScript. |
| differences between them? Howshould they be used | | | | A SPAN tag is not intended to container other tags, |
| to markup web pages? | | | | but ratherto allow localised styling. This is especially |
| The basic difference between the two is their | | | | useful whencombined with classes. It has even been |
| default behaviour. | | | | suggested that futuresemantic web models will use |
| DIV tags are block-level tags and can be used as | | | | such markup to define relevantcontent. |
| containers forother tags. SPAN tags are inline tags | | | | For example by defining a class telephone, when can |
| and should only containcontent. These default | | | | ensure alltelephone numbers are displayed in the |
| behaviours can of course be altered by | | | | same fashion: |
| CSS definitions, but are default in any browser | | | | 44-20-555-4444 |
| context. | | | | SPAN tags have similar properties but should be used |
| As a reference, if you want to align text within these | | | | toreference inline content and apply style by classes. |
| tags usethe following CSS attributes; | | | | In summary: use divs for defining sections of a page, |
| DIV - text-align: left|right|center|justify | | | | and spansto enclose and style text or classes of |
| SPAN - float: left|right | | | | text. |
| DIV tags are also used to define logical divisions of | | | | Permission is granted for reproduction of this article, |
| pagecontent. It also allows CSS to be defined for | | | | so longas it is published in its entirety, with footnotes |
| whole sections of | | | | attached. |
| HTML. By applying an id to a DIV you can also add | | | | |