Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

Changing the Style of HTML with Tags

Logical and Physical HTML Tags

By Jennifer Kyrnin, About.com

When you think of HTML style you probably instantly think of CSS (Cascading Style Sheets), but style with straight HTML really refers to the formatting of the characters on the screen using HTML tags to do it.

There are two types of style tags within HTML:

  • logical
    tag the information according to its meaning (i.e. header, code, etc.)
  • physical
    tag the exact appearance of the information

Many of the styles in HTML documents can be achieved using either type of style tags. For example, the physical style tag <i> makes text italic and in most browsers the logical style tag <em> makes text italic.

Why Do We Need Two Types?

HTML was developed from SGML (another markup language) and in SGML, the presentation (style) is divorced from the content. For example, when you were in school, you were probably taught to write essays by first writing an outline. Then you could write the document and put in the formatting. HTML, in its pure form, wants to focus only on the content of the document, and not how it looks. It leaves the look and feel to something else (the browser, CSS, etc.).

Logical Style Tags

  • <dfn>
    definition
    Used to define a word or phrase within a document. Typically displays in italics.
  • <cite>
    citation
    Used to note titles of books and movies etc. Typically displays in italics.
  • <code>
    computer code
    Used to indicate computer code. Typically displays in a fixed-width font.
  • <em>
    emphasis
    Used to emphasize a word or phrase. Typically displays in italics.
  • <hX>
    header (1 - 6)
    Six different levels of header. Each level displays differently.
  • <kbd>
    keyboard entry
    Used to indicate something to be typed in. Typically displays in a fixed-width font.
  • <samp>
    sample
    Used to indicate a sampling of literal characters.
  • <strong>
    strong emphasis
    Typically displays in bold.
  • <var>
    variable
    Used to display computer programming variable information. Typically displays in italics.

Physical Style Tags

  • <b>
    bold
  • <i>
    italics
  • <font>
    change the font face, size, or color
  • <tt>
    fixed-width (typewriter) font

Which Type Should I Use?

Both types are supported in HTML 3.2, and while some of the physical styles (<font> specifically) are deprecated in HTML 4.0, the browsers still support them.

However... HTML is moving away from defining the look and feel of Web pages, leaving that to CSS. If your readers are mostly using 4.0 browser, then you should seriously consider using logical tags with style sheets to define how they look. If you do that, your pages will be compatible with future browsers that might not support physical styles (because they are not in the HTML specification).

Learn more about these and other tags in the HTML Tag Library.

Explore Web Design / HTML

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. About.com Web Design A to Z
  5. Web Design Articles A-H
  6. Web Design/HTML Articles C
  7. Changing the Style of HTML with Tags

©2009 About.com, a part of The New York Times Company.

All rights reserved.