SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 47
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 1999
    Location
    Kuala Lumpur, Malaysia
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML 4.0 or XHTML 1.0?

    I'm not sure whether this has been asked before, but here goes.

    To ensure current and future compatibility, which one should I use, and why?
    DarkStation - No-nonsense Console Gaming Coverage.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If coded PROPERLY, both of them will be compatible for many years to come. None of the browser makers have any intention of dropping HTML4 support any time in the foreseeable future.

    If you're going the XHTML route, remember that you're going to need to separate your structure from your design as completely as possible. This means full use of CSS for layout of your page and as few tables as possible. XHTML is both backwards and forwards compatible -- it'll render on current and past browsers, but you're not going to have the same presentation on 4x generation and older (to most people, this means Netscape 4.x) browsers. They'll get the content, but likely not the design. The advantage to XHTML is easier updating, and if validly written, compatibility with most current and future browsers, phones, PDAs, and accessibility such as screen readers. Writing valid XHTML will also make it much reader to reach those accessibility guidelines becoming law in many countries. Another huge advantage is in bandwidth -- the average XHTML1.0/CSS page (like SitePoint's site, specifically outside of the forums) is much lighter than an HTML4 page because all you get is the content, not the formatting. The stylesheet only has to be downloaded once. Speaking of that, don't forget you can change the entire look and feel of your site, the entire design, just by editing your stylesheets.

    If you need it to look pixel perfect in older browsers without the CSS support a true XHTML/CSS page requires, go with HTML 4. Like I said above, you still need to code it properly, and browsers won't stop supporting this in the future as long as you make proper use of the DOCTYPE tag. You can figure out the drawbacks by reading the advantages of XHTML.

    If you're interested in the XHTML/CSS route and want some extra help, I recommend the book "Designing with Web Standards" (much over SP's book).

    Good luck

  3. #3
    SitePoint Guru quenting's Avatar
    Join Date
    Dec 2002
    Location
    Switzerland
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This means full use of CSS for layout of your page and as few tables as possible
    I don't see anywhere in xhtml where it states you have to use as few tables as possible.
    xhtml just means "clean code" and "xml compatible", and while the philosophy behind it is that it provides a better environment for CSS prevalence over tables it doesn't mean you have to do it. You can also style tables with CSS very easily, and in some (many ?) cases that will do a cleaner and smaller html (which are the two main arguments for CSS-P) than if using CSS.

    just my 2 cents
    Quentin
    The largest message boards on the web !
    unblog.fr, hosting 700000 french blogs

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    XHTML doesn't state anything about how you should go about using it -- you can wrap your site in a million tables and make each page a megabyte in size.

    It's just the philosophy that goes along with transitioning towards XML. If you don't want to try to adopt that philosophy, stick to HTML 4? This is just my advice as well, but I see no reason to use XHTML if you're not going to make the full changeover from the old way of thinking about web page design.

    Another 2 cents from me. You're getting rich, Rizal.

  5. #5
    SitePoint Addict hurricane.uk's Avatar
    Join Date
    May 2003
    Location
    Liverpool
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XHTML is an extension of the HTML 4.01 standard, bringing XML functionality into it. By using xhtml over html 4.01 you will be opening your site up to a number of UAs that can't access html as well as a browser can, and also providing the capacity for your markup to interact with programming and scripting languages in a more logical way.

  6. #6
    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)
    eXtensible HyperText Markup Language (XHTML) is well-formed eXtensible Markup Language (XML) that has been written to mimic HTML 4.01.

    Thus for future proofing the XHTML Family has the edge and potentially a wider user-agent, platform base and greater interoperability as was mentioned before.

  7. #7
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Woot, our thread made it into the Tech Times

  8. #8
    Team SitePoint AlexW's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne
    Posts
    832
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I think XHTML is a good habit to get into. It takes little time to learn the differences and is more accessible for non-browser devices. Anyway it feels good

    After a while I couldn't bring myself to write HTML anymore. I kinda feel dirty even seeing a <br> in my old code, let alone writing one... hehehe . Have to spin a find and replace through the code before I can touch it. And unclosed list items?!?! (involuntary shiver)
    Alex Walker
    SitePoint Developer
    SitePoint - Learnable

  9. #9
    because you gotta have beer! firegryphon3207's Avatar
    Join Date
    Apr 2000
    Location
    Roxbury/Boston
    Posts
    479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexW
    And unclosed list items?!?! (involuntary shiver)
    I'm not having too much trouble making the change. I was already in the habit of closing tags to begin with. When I started learning, I closed all tags possible, it was too confusing to try and remember which ones you had to close and which ones you didn't. It does feel good because your code is nice and neat. I have however been very lazy about changing some old code.
    Alone we can do so little; together we can do so much.
    -----------------------------------------------------
    tinyplanet.org <--a nifty spot.

  10. #10
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by AlexW
    I think XHTML is a good habit to get into. It takes little time to learn the differences and is more accessible for non-browser devices. Anyway it feels good

    After a while I couldn't bring myself to write HTML anymore. I kinda feel dirty even seeing a <br> in my old code, let alone writing one... hehehe . Have to spin a find and replace through the code before I can touch it. And unclosed list items?!?! (involuntary shiver)
    <br /> still has valid uses however. Try creating a layout that makes extensive use of floats; you'll find that you need a <br clear="all" /> in there at least once.

  11. #11
    Team SitePoint AlexW's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne
    Posts
    832
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Oh I have nothing against '<br />'. Use it all the time.. ... just the non self-closing version '<br>' makes me feel the need to wash.
    Alex Walker
    SitePoint Developer
    SitePoint - Learnable

  12. #12
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by AlexW
    Oh I have nothing against '<br />'. Use it all the time.. ... just the non self-closing version '<br>' makes me feel the need to wash.
    Yes it's a "dirty" tag to me, even in XHTML. I use it only when necessary .

  13. #13
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What does <br clear="all" /> do?

    I'm only 3/4 through "Designing with Web Standards" and haven't started "Eric Meyers on CSS" yet.

  14. #14
    Team SitePoint AlexW's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne
    Posts
    832
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Doesn't <br style="clear:both"> work pretty much the same as "<br clear="all" />" ?

    (I wouldn't normally do it inline like that)
    Alex Walker
    SitePoint Developer
    SitePoint - Learnable

  15. #15
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Don't know what either do

  16. #16
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,491
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <br clear=all or left or right or none> breaks the text flow and resumes the next line after the specified margin is clear. This is often used to start the text below an aligned image (preventing text wrap). "none" is the default, causing a simple line break.

  17. #17
    SitePoint Enthusiast
    Join Date
    Aug 1999
    Location
    Kuala Lumpur, Malaysia
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexW
    I think XHTML is a good habit to get into. It takes little time to learn the differences and is more accessible for non-browser devices. Anyway it feels good [img]images/smilies/smile.gif[/img]
    I'm in the middle of re-coding everything to validate to XHTML 1.0 standards. It was hard remembering closing those tags, making sure everything was properly nested but I feel much better now.
    Last edited by Rizal; Jul 24, 2003 at 02:39.
    DarkStation - No-nonsense Console Gaming Coverage.

  18. #18
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    <br /> still has valid uses however. Try creating a layout that makes extensive use of floats; you'll find that you need a <br clear="all" /> in there at least once.
    Why bother doing a CSS layout if you are going to keep on using Transitional HTML?

    Douglas
    Hello World

  19. #19
    SitePoint Enthusiast
    Join Date
    Aug 1999
    Location
    Kuala Lumpur, Malaysia
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm already sold on XHTML 1.0. Now I need to compile a list of browsers (and their versions) that support (fully/partial) this standard. Any ideas?
    DarkStation - No-nonsense Console Gaming Coverage.

  20. #20
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,491
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Rizal
    I'm already sold on XHTML 1.0. Now I need to compile a list of browsers (and their versions) that support (fully/partial) this standard. Any ideas?
    Are you looking for resources?

  21. #21
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Rizal
    I'm already sold on XHTML 1.0. Now I need to compile a list of browsers (and their versions) that support (fully/partial) this standard. Any ideas?
    No browser (that I know of) supports XHTML as XML, but most are quite happy to treat it as HTML 4.01 (If you follow these guides)

    Douglas
    Hello World

  22. #22
    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)
    Well just remember within HTML 4.01 the start and end tags for the HTML, HEAD and BODY elements are optional, but specifying the Document Type Definition, the character encoding and the TITLE is a requirement.

    That was one of the main reasons I never really liked HTML 4.01.

  23. #23
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DougBTX
    No browser (that I know of) supports XHTML as XML, but most are quite happy to treat it as HTML 4.01 (If you follow these guides)

    Douglas
    if i remember correctly, an xhtml strict document sent as application/xhtml+xml to Opera7 is treated as xml...so much so that if there is an error in its syntax, it shows a big fat error message right where the syntax error occurred (and not some quirks mode stuff)
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  24. #24
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DougBTX
    No browser (that I know of) supports XHTML as XML, but most are quite happy to treat it as HTML 4.01
    Mozilla likes XML content just fine

    <meta http-equiv="Content-Type" content="text/xml; charset=UTF-8" />
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  25. #25
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by redux
    if i remember correctly, an xhtml strict document sent as application/xhtml+xml to Opera7 is treated as xml...so much so that if there is an error in its syntax, it shows a big fat error message right where the syntax error occurred (and not some quirks mode stuff)
    I stand corrected

    IE6, Moz and Opera all throw nice big errors with invalid XML sent as XML, very cool. (That means that... I can use XHTML 2... today?)

    There is hope yet

    Douglas

    Edit:

    In each case, I sent this as application/xml along with a style sheet:

    Code:
    <?xml-stylesheet href="xml.css" type="text/css"?>
    <mytag>
    <my>hi</my>
    <my>hii</my>
    <my>hi</my>
    </mytaggggggg>
    With a correct end tag, all render the same

    I wonder what IE5/IE5.5 do with it...

    Douglas

    Edit:

    Works 100% in IE5.5 by the looks of it atleast when loaded off your harddrive...

    Hello World


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
  •