SitePoint Sponsor

User Tag List

Results 1 to 24 of 24
  1. #1
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)

    XHTML Strict vs Transitional

    Which form of XHTML is better to use for cross-browser compatability? Strict or Transitional?

  2. #2
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    No difference as far as cross browser compatibility. The main differences is that some markup deprecated in Strict, is allowed in Transitional.

    eg:
    Code:
    target=_blank
    I'm sure there is more.

  3. #3
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are more differences.

    For instance, in strict only block level elements may be a direct child of <form>.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  4. #4
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Transitional was designed to ease the transition from HTML&#160;3.2 to HTML&#160;4.0. Strict is how HTML&#160;4.0 was intended to be used (i.e. semantic markup in combination with stylesheets).

    XHTML&#160;1.0 is a reformulation of HTML&#160;4.0 in XML, so XHTML&#160;1.0 Transitional is there to ease the transition from HTML&#160;3.2 to XHTML&#160;1.0.
    Simon Pieters

  5. #5
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    ah, I see.

    So is it best to use Strict when possible since the transition has more or less passed?

  6. #6
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow
    ah, I see.

    So is it best to use Strict when possible since the transition has more or less passed?
    I generally code in strict because (to be honest) I learned to do it that way before I learned to do it any other way.

    Though I am not sure that strict is necessarily better than transitional or frameset for that matter. Nor is (X)HTML any better than HTML. So don't be mislead to think that you have to use (X)HTML.

    No matter what language you use, the main thing is to make sure that you are using well structured markup.

    I'm sure someone else can explain it better

  7. #7
    SitePoint Wizard silver trophybronze trophy Nadia P's Avatar
    Join Date
    Oct 2004
    Location
    NSW Australia
    Posts
    3,564
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Johnny Gulag
    No matter what language you use, the main thing is to make sure that you are using well structured markup.
    I'm sure someone else can explain it better
    I think you said it quite well.

    Nadia

  8. #8
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Johnny Gulag
    The main differences is that some markup deprecated in Strict, is allowed in Transitional.

    eg:
    Code:
    target=_blank
    Actually, that's not valid XHTML 1.0 Transitional either. Attribute values must always be quoted in X(HT)ML:
    Code:
    target="_blank"
    Birnam wood is come to Dunsinane

  9. #9
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Johnny Gulag
    I generally code in strict because (to be honest) I learned to do it that way before I learned to do it any other way.

    Though I am not sure that strict is necessarily better than transitional or frameset for that matter. Nor is (X)HTML any better than HTML. So don't be mislead to think that you have to use (X)HTML.

    No matter what language you use, the main thing is to make sure that you are using well structured markup.

    I'm sure someone else can explain it better
    So then what is the advantange of using XHTML Strict/Transitional over HTML (or visa versa)?

  10. #10
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo
    Actually, that's not valid XHTML 1.0 Transitional either. Attribute values must always be quoted in X(HT)ML:
    Code:
    target="_blank"
    You caught me on that one Tommy. I forgot to type the ""'s

  11. #11
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    Hmm...now that I've been fooling back and forth with a page between XHTML strict and XHTML transitional, I'm finding that it's a real pain not to be able to use "align" and "width" attributes in XHTML strict.

  12. #12
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use CSS. The width and align attributes were removed from XHTML 1.0 Strict because CSS makes them obsolete.

    With XHTML, you can mix in other varieties of XML, for example MathML and SVG.

    Unfortunately, people have heard about it and they feel they must use the hot new technology without bothering to learn the implications. *sigh*
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  13. #13
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you are using CSS for styling, then I would recommend you use XHTML 1.0 Strict.

    If you are using HTML 3.2 style code for styling, such as 'font' elements, 'center', 'align' attributes, etc then I would recommend you use XHTML 1.0 Transitional. From what you've said above, it sounds like you prefer to use the old fashioned styles in which case there is nothing wrong with sticking with XHTML 1.0 Transitional for now.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  14. #14
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    ok

    I'm not really comfortable relying completely on CSS for positioning and sizing of tables. I do, however, use it for text styling.

    I've been looking into it for positioning and sizing for tables all day hoping that would have solved the problem I'm having, but unfortunately, it didn't.

    http://www.sitepoint.com/forums/showthread.php?t=272215

  15. #15
    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)
    Strict is probably the more sensible though Transitional has it advantages for some of the older browsers that weren't up to scratch. It's catch-22 really as a Transitional Document can be as Strict as the strict under certain circumstances.

  16. #16
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xhtmlcoder
    It's catch-22 really as a Transitional Document can be as Strict as the strict under certain circumstances.
    Right, a Transitional document that contains no markup deprecated in the Strict doctype will validate as Strict, if the doctype is changed.

  17. #17
    SitePoint Enthusiast MstrBob's Avatar
    Join Date
    Dec 2004
    Location
    New York City
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow
    ah, I see.

    So is it best to use Strict when possible since the transition has more or less passed?
    You hit the nail on the head there. I really don't see why one would need to use Transitional when creating new documents today. It's been years now and HTML 4.01 is the norm. There is not transition, the only time I'd say it's applicable is when using Frames, since the Frameset DTD is in essence the Transitional DTD.

    Considering we should be using HTML 4.01 Strict when creating new documents, XHTML 1.0 Strict should fit us just fine. Unfortunately, there are developers jumping into XHTML with no idea what it is, and who haven't even figured out HTML. If you're leaping from HTML 3.2 to XHTML 1.0, then you might want to use Transitional. But only for a time. You should be using XHTML 1.0 Strict unless you need what transitional has, such as Frames.

    We all know we should be using CSS and not presentational markup, right?

  18. #18
    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)
    Yeah agreed, presentational markup like <hr> is on they way out.

  19. #19
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm... You consider <hr> to be presentational markup? I suppose it is.

    I think <center> and the harmful <font> elements are better examples.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  20. #20
    SitePoint Enthusiast MstrBob's Avatar
    Join Date
    Dec 2004
    Location
    New York City
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Indeed. In XHTML 2, it's replaced with <separator />, which I suppose is a bit better than <hr />. But, I really think it should be done away with. Don't you think it's really sort of a visual-only thing? Sorry, little off topic here...

  21. #21
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well a screen reader could pause when it got to a <seperator />, couldn't it?
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  22. #22
    SitePoint Enthusiast MstrBob's Avatar
    Join Date
    Dec 2004
    Location
    New York City
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess you could. But semantics is not just "what will a screen reader do?" Think about what that element actually does. It separates content? Wouldn't it be the same as using two different element. If I have:

    HTML Code:
    <p>This is a paragraph.... yatta yatta yatta...</p>
    
    <p>This is a separate paragraph. yatta yatta yatta </p>
    Why do I need a separator? Generally, I find that it'd be better served by putting another heading. Or else I've found that I'm using <hr> to replace an unordered list. I personally just don't use them, and if I need to recreate the effect, a simple border-top:2px inset #fefefe; does it just fine.

  23. #23
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    (Read about HR and SEPARATOR in Steven's slides.)
    Simon Pieters

  24. #24
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    As long as you know the little differences between coding in Strict and Transitional and you pay attention, neither one is really any better or worse than the other. If you need things like the target attribute for whatever reason, then stick with Transitional. Otherwise, try Strict out and see if you can get the hang of it. I work in both for different sites and reasons.


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
  •