Monday, July 12, 2010

xhtml: logical vs physical tags

Just a random blob with "XHTML" writ...Image via Wikipedia

HTML includes two types of Style Tags:

  • logical (a.k.a. phrase elements)
    tag the information according to its meaning (e.g., abbr, acronym, code, etc.)
  • physical
    tag the exact appearance of the information (i.e. b, i, etc.)
Both <em> and <i> display italics. CSS is the preferred way to style content rather than logical tags. Logical style tags are preferred over physical tags (which is why the latter are deprecated in xhtml).

Rationale: the goal in xhtml is to separate structure elements from style elements, and remove the latter from xhtml. Content should be styled with CSS rather than xhtml. Logical tags describe the structure or semantics of content and are, therefore, preferred over style elements like <b> and <i>.
Enhanced by Zemanta

No comments: