Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 4 123 ... LastLast
Results 1 to 15 of 47

Thread: HTML or XHTML?

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Victoria, BC, Canada
    Posts
    962
    Thanks
    0
    Thanked 1 Time in 1 Post

    HTML or XHTML?

    I am thinking of doing a(nother) website, and have been wondering about whether to use HTML or XHTML. Is there really any difference between the two? Is one better than the other? I already know HTML, and have no knowledge of XHTML, and it would be great if I didn't have to learn something new to do the webpage. Is is possible to convert HTML to XHTML after it is written, or should I start with XHTML from scratch?

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    TBH I don't know that much about xhtml, but I heard that it's supposed to take over the role of html now or in the future.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Victoria, BC, Canada
    Posts
    962
    Thanks
    0
    Thanked 1 Time in 1 Post
    So it would be a good idea to move up to the current version?

  • #4
    umm
    umm is offline
    Regular Coder
    Join Date
    Sep 2002
    Location
    Antipodes
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts
    XHTML is an XML application. It's primary aims are
    (a) extensibility - it's vocabulary can be more easily added to (manipulated) and,

    (b) portability - in theory, it should be able to be shared across a wide variety of user agents. In other words, there can be no proprietary tags.

    HTML 4.01 is the last and final version of HTML. XHTML has taken the HTML4.01 markup and used them to make an XML application. For all practical purposes, XHTML is just a stricter version (in terms of syntax) than HTML.

    I doubt whether XHTML will replace HTML any time soon. UserAgents have to be backward compatible to some degree or another (imagine a browser that didn't support HTML!)

    It's not hard to upgrade from HTML to XHTML. I use XHTML but I really wonder why I should. It offers me no extra functionality (at this stage).

    In the end, I think it's just that I like the "X" in front of HTML

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If i understand correctly (no, really), no browser will choke on strict and valid XHTML, even if it doesn't support it. A number of rules behind coding strict XHTML should yield better, cleaner code, so i personally would recommend to adhere to at least those rules, like closing all container elements with the appropriate end tag, properly nesting container elements, enclosing all attributes in quotes, etc.
    Moreover, if your code is strict, you can apply a validator to check it to make sure you didn't leave any typos.
    I would recommend taking the step to XHTML!
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    XHTML will be great when it becomes more popular because it will force people to write cleaner code (easy debug). For now it is just hype. If you are creating static web sites do not bother with trying to learn XHTML . The only reward now is getting a cool "W3C valid XHTML" icon on the bottom of your site.

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    XHTML 1.0 is meant to be backward compitable,so its just HTML with the XML syntax,XHTML 2 on the other hand will be really diferent with alot of new functionality.

    Its realy recommended to switch to XHTML,since its makes your site cross-browser.XHTML doesnt contain propriatary ****,and the syntaxt valid,so all browser should render it the same.And it isnt any harder to do,if you have DreamWeaver MX you just have to configure it to use XHTML and youre done.

  • #8
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Originally posted by allida77
    The only reward now is getting a cool "W3C valid XHTML" icon on the bottom of your site.
    And not having to rewrite it later.

    If I write something in XHTML 1.0 Strict or XHTML 1.1 right now, I can be pretty much assured it will work perfectly in web browsers 5 years down the line. If I leave it in HTML, no guarentees. And not only that, but say an entirely new format takes over for webpages. With HTML, you'd be stuck writing it over by hand (at least until a converter comes out, which probably will not get it exactly). With XHTML, you could write a simple XSLT transformation sheet to convert it to the new format, and apply the sheet to all of your pages. Instant change.

    XHTML 1.0 is backwards compatible with HTML4 (<br/> is valid HTML, but NS4 requires <br /> to render it, and that's the only exception), so really the only question is, why not?

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by jkd
    ... so really the only question is, why not?
    The best reason to use xHTML now is so you loose all the bad habits that years of coding for browsers that accept all manner of bad code. Otherwise you can continue coding the way you have in the past and try to break all those habits only when it becomes absolutely necessary, of course you'll get lots of practice as you have to go back and fix all the bad code you generated in the past.

    Not trying to shoot anyone in particular here but any time at all spent looking at the code for various sites is an exercise in the amazing ways that bad code can be done while the page still works (or more often, mostly works).

    Imagine how much more trim and quick a browser could be if it didn't have to spend a lot of CPU and memory supporting all the defects in the way people use HTML just so the browser doesn't appear to break millions of sites (when the truth is that it's those millions of sites that are broken). A serious mistake in browser development was to make the browser forgive bad html in the interest of being competive against the leading browser which also forgave bad html. All that did was encourage the use of bad html because people would tweack the html until it "looked" right when viewed with the browser.

  • #10
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,461
    Thanks
    1
    Thanked 23 Times in 21 Posts
    Be nice if this thread was in my forum, but...

    One of the major advantages of XHTML (particularly 1.1 and the upcoming 2.0) is the ability to intermix other XML languages with XHTML. For instance, with XHTML 1.1 + MathML 2.0, a DTD the World Wide Web Consortium provides, you can include MathML equations in an XHTML document without any real validation problems. (Of course, Internet Explorer is psychotic on the W3C's DTD for that sort of document. )

    There's also one more very important reason to start writing XHTML. Because it is XML, it forces you to code very correctly, very strictly. That same strictness helps a great deal in stabilizing the Document Object Model for your document.

    In other words, serious JavaScripters should consider writing XHTML from the start.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #11
    New Coder
    Join Date
    Sep 2002
    Location
    Long Island, NY
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Take a look at this...

    The W3C HTML Home Page has lots and lots of information on ths subject and more...

    here is a list of recomendations on XHTML. There is alot of other useful reading if you are serious about putting the energy into it. (which is really not that much!)

    and off the subject...you should also look into XFORMS as well.

    good luck!!
    Last edited by ddubs; 09-17-2002 at 04:25 AM.

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Location
    Victoria, BC, Canada
    Posts
    962
    Thanks
    0
    Thanked 1 Time in 1 Post
    What does XHTML do to javascript? I used the W3C Validator, and it had problems with simple onMouseOver and onMouseOut statements, with images. Any idea what's going on?

  • #13
    umm
    umm is offline
    Regular Coder
    Join Date
    Sep 2002
    Location
    Antipodes
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts
    onMouseOver should be onmouseover. In XHTML tags, element names, attributes etc are written in lowercase. Tags without a closing tag, such as the <img> element need a closing "/" like this:
    <img src="blah.gif" />

    The same goes with form input elements as it does with <br /> and <hr />
    Last edited by umm; 09-17-2002 at 09:58 AM.

  • #14
    Regular Coder
    Join Date
    Jun 2002
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you know how to write valid HTML, then you pretty much know 99% of XHTML, at least XHTML 1.0.

    Try http://www.w3schools.com/xhtml/default.asp for a quick overview.

  • #15
    Regular Coder
    Join Date
    Jun 2002
    Location
    Victoria, BC, Canada
    Posts
    962
    Thanks
    0
    Thanked 1 Time in 1 Post
    I fixed the onmouseover and onmouseout- no errors from that anymore.

    However, I'm still getting an error with the Character Encoding- none detected. What's that about? Here's the link to the validation page.

    http://validator.w3.org/check?uri=ht...com/hommworld/


  •  
    Page 1 of 4 123 ... LastLast

    Posting Permissions

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