SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Addict gl3nnx's Avatar
    Join Date
    May 2005
    Location
    at http://www.gl3nnx.net
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Difference between XHTML strict and transitional

    just wondered whats the use of strict and transitional.., any benefits if i will recode my xhtml transitional site into a strict version? pls give me an advice.

  2. #2
    Pedantic Semantic blain's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Transitional does exactly what it says on the tin.

    Lets say that your current page is HTML Tag soup, it resembles a geocities site from 1999, font tags, center tags, marquees etc.

    You decide that you want to sort out your HTML and get it looking something like. So your site is in a transition from tag soup to HTML 4.01 Strict, transitional is a mid point.

    Atleast that's how I see it.

  3. #3
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gl3nnx
    just wondered whats the use of strict and transitional.., any benefits if i will recode my xhtml transitional site into a strict version? pls give me an advice.
    The benefit to you of using a Strict DOCTYPE is that it encourages you to avoid presentational markup by forcing you to separate your presentation (CSS) and structure (HTML). Which is of course the right way to do things.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,255
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    XHTML transitional

    A "nutshell" desciption: If the mark-up isn't seperated from the style it's transitional. Strict doesn't let you use b, u, font, center, etc. tags. Benefits? you can maintain the site's style without having to hunt through the mark-up for style elements. BTW, unless your server is sending the correct headers, the page is served as HTML not XHTML, but that's a whole other topic.

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As blain said, a Transitional doctype is meant to be used in a transitional (gasp!) period while you're bringing an old-school tag soup document kicking and screaming into the 21st century. Just to be able to validate until you can get rid of all the presentational markup.

    A Strict doctype is what you should use for all new documents. It 'enforces' the separation between structure (X/HTML), presentation (CSS) and behaviour (JavaScript).

    Quote Originally Posted by Mittineague
    Strict doesn't let you use b, u, font, center, etc. tags.
    Boldfacing (<b>...</b>) is allowed in Strict doctypes, as well as italicising (<i>...</i>). Most other presentational markup has been thrown out, though.
    Birnam wood is come to Dunsinane

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by gl3nnx
    any benefits if i will recode my xhtml transitional site into a strict version?
    You'll get a smug sense of satisfaction and you can sneer at those lowly designers using only transitional.

    In the real world, you won't see any benefits other than (possibly) cleaner code for you to look at. This can be a big benefit in and of itself when it comes time for site maintenance, but it's up to you to decide whether it's worth it on your site.

    I'd also like to add that you can code with Strict's rules under a Transitional doctype just fine; it's just up to you to enforce the strictness instead of a validator.

  7. #7
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    I'd also like to add that you can code with Strict's rules under a Transitional doctype just fine; it's just up to you to enforce the strictness instead of a validator.
    You can also author with Strict's rules without a doctype, but in both cases you won't get the Full Standards Mode in modern browsers (assuming text/html). (Transitional doctypes trigger Almost Standards Mode at best.)

    You can still validate against any DTD by using the DTD override feature in the W3C Validator, or even validate against XML Schema or RELAX NG.
    Simon Pieters

  8. #8
    SitePoint Addict gl3nnx's Avatar
    Join Date
    May 2005
    Location
    at http://www.gl3nnx.net
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow cooll thanks guys, but i heard that theres some problems in browser that producing some change in layout when inserting the strict document tag, i also experience that.. firefox is producing space between my image when i use the strict tag

  9. #9
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't just change the doctype declaration from Transitional to Strict. You also need to learn how to use (X)HTML and CSS properly.

    (X)HTML is a markup language, not a page design language. That's what CSS is for.
    Birnam wood is come to Dunsinane

  10. #10
    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 gap probably because you are using the DOCTYPE and are you misusing tables for layout.

  11. #11
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Images are (replaced) inline elements, which means that the generated box will align vertically within the surrounding line box. The default vertical alignment is baseline, which means that the bottom edge of the image aligns with the basline of the text ... even if there is no text adjacent to the image.

    Older browsers incorrectly aligned images to the bottom of a table cell if there was no other content in the cell. That does not happen in 'standards' mode, which is triggered by a Strict doctype.

    You thus need to set the vertical alignment yourself, or change the type of the generated box from inline to block. Either of these should work:
    Code:
    td img {vertical-align:bottom}
    td img {display:block}
    However, that is just fixing the symptoms, rather than curing the illness. The problem is that you are abusing the markup language for presentational reasons. Images are rarely tabular data, hence they should not be used with table markup.
    Birnam wood is come to Dunsinane

  12. #12
    SitePoint Enthusiast cssiscool's Avatar
    Join Date
    Feb 2006
    Location
    East Moline, Illinois
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if i had a professional site i would use only strict. but since my site is a help site for newbies and i have to link to a lot of stuff i want to open in a new browser window. so i use transitional.

  13. #13
    Pedantic Semantic blain's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cssiscool
    if i had a professional site i would use only strict. but since my site is a help site for newbies and i have to link to a lot of stuff i want to open in a new browser window. so i use transitional.
    I can see where you are coming from but using transitional so you can use target=blank is not really the answer.

    opening a new browser window is a behaviour, therefore it should be accomplished using javascript not HTML.

    Remember

    HTML for structure
    CSS for presentation
    Javascipt for Behaviour


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
  •