Friday, July 24, 2015

Div vs Span


Block Element
Legal to have a span within a DIV

w3c Describes span as follows;

"The div element has no special meaning at all. It represents its children. It can be used with the class, lang, and title attributes to mark up semantics common to a group of consecutive elements."


Inline Element
Illegal to have a DIV within a span

w3c Describes span as follows;

"The span element doesn't mean anything on its own, but can be useful when used together with the global attributes, e.g. class, lang, or dir. It represents its children."