SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sub / sup and CSS text properties

    While whistling along and checking out the HTML reference I came upon the tags sub and sup. Their usage seem to give me the feeling of the <i>/<b> tag discussions, where they seem to be for simple styling purposes, which can be done through CSS. However, I'm under the impression that they may have semantic purpose within the realm of formulas, as stated in the description of their common usage.

    So to conclude, is there enough semantic meaning behind these tags to use them in their correct situations, or should I be text styling with CSS instead?

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's been a lot of debate about this over the years, as well as about the pre and br element types.

    I personally consider sub and sup to be semantic, rather than presentational.

    Code:
    E=mc<sup>2</sup> <!--Einstein's famous equation-->
    E=mc2            <!--random characters-->
    
    H<sub>2</sub>SO<sub>4</sub> <!--Sulphuric acid-->
    H2SO4                       <!--random characters-->
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    I agree with Tommy. The tags has semantical importance in mainly math and physics. On the other hand, it would not be semantically correct to use them to denote e.g. foot note references. To show an example where the semantics are important, consider the following two equations:
    Code html4strict:
    3<sup>2</sup>x
    3<span class="raised">2</span>x
    If we set x to 5, the first result will be 45 and the second will be 160. Furthermore, it is clearly evident that this would actually defeat the purpose of seperating markup and styling, since the class is named based on the appearence.
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •