SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML LANG and META content-language at the same time?

    Dear forum,

    I have a HTML 4.01 Strict website that I'm charged with updating.

    In the HTML, on line 2 right after the DOCTYPE, I have:
    Code:
    <html lang="en">
    A little further down in the HEAD there is also:
    Code:
    <meta http-equiv="content-language" content="en">
    Now, it appears to me that one of these should be superfluous. Don't they both simply tell UA's that the content is in English?

    Should I remove one for simplicity? If so, which one is least important, i.e. which one is least semantic / least supported?

    Thanks

  2. #2
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first one:
    Code HTML4Strict:
    <html lang="en">
    is used for processing content where the second:
    Code HTML4Strict:
    <meta http-equiv="content-language" content="en">
    is used to specify what the aimed audience is. So as you can see the have a different purpose.

  3. #3
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    The 'lang' attribute has higher precedence but you may also set it with the Content-Language HTTP header they probably have a similar level of support.

    Like was mentioned the one on the HTML applies to the content between the HTML element.

    Usually you'll see the 'lang' attribute also appear within other elements such as SPAN to target specific language change within a page's content. For example: <span lang="es">Soy un perdedor</span> within a English document. It basically doesn't harm having both options available.
    Last edited by xhtmlcoder; Nov 28, 2010 at 07:38. Reason: Typographical issues.

  4. #4
    SitePoint Zealot
    Join Date
    May 2009
    Location
    Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The lang attribute is read by the browser and the meta tag is read by some search engines


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
  •