SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2006
    Posts
    443
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Should I use HTML5 or XHTML?

    Hi

    Can we today get rid of XHTML tags (for example self closing tag like < element /> )? My main point is that I'm going to build a small project should I use HTML5 in it or XHTML? which one is preferable any why?

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,600
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by CS Geek View Post
    Hi

    Can we today get rid of XHTML tags (for example self closing tag like < element /> )? My main point is that I'm going to build a small project should I use HTML5 in it or XHTML? which one is preferable any why?
    If you can't decide then why not use XHTML5 - that's the XHTML equivalent of HTML 5.

    The biggest difference between HTML 5 and XHTML 5 (apart from their MIME type) is that XHTML 5 doesn't have a doctype at all as there is only standards mode in XHTML and version 5 of both have done away with the SGML doctype so that HTML 5 only needs the short version to turn off quirks mode.

    Of course XHTML isn't supported in Internet Explorer 8 or earlier and (X)HTML 5 isn't fully supported in any browser yet (since it hasn't even been finished yet) so of all the current alternatives HTML 4 is the only one that works everywhere and XHTML 1 works everywhere other than old versions of IE. Of course (X)HTML5 is mostly supported in the latest version of each browser (apart from whatever they decide to change before they finish it).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Non-Member
    Join Date
    Sep 2013
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML5 is the latest version.....I would prefer to use HTML5.....

  4. #4
    SitePoint Addict WebMachine's Avatar
    Join Date
    Jun 2007
    Location
    Ontario, Canada
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's got to be a reason other than it's "the latest version". What makes html5 preferable over xhtml? If we jumped on the bandwagon every time a new version came out, we'd be constantly switching to a new technology and never having the chance to become an expert in the current one. At what point does it make sense to move on?

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,594
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by WebMachine View Post
    There's got to be a reason other than it's "the latest version". What makes html5 preferable over xhtml?
    Nothing, really.

    If we jumped on the bandwagon every time a new version came out, we'd be constantly switching to a new technology and never having the chance to become an expert in the current one. At what point does it make sense to move on?
    The move towards HTML5 isn't an overnight fad that will change tomorrow. It introduces new elements that will probably be around for a long time to come (for better or worse), such as <video> etc. But it's still just HTML.

    At the end of the day, it matters nought which doctype you use, as browsers will render the pages just fine—and that's what counts. HTML5 is quite happy with the XHTML-style tags, such as <img />, so use whatever floats your boat. Personally, I've switched to the simpler doctype, because it's neater and it works just fine.

    You don't need to learn anything new to use the new doctype. There are new elements you can use, if you wish, and you can continue to write your code just as you did before (closing off tags etc.). XHTML introduced some good coding habits, and that's its legacy. There's no need to throw that out.

  6. #6
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,149
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Is there even any practical benefit to XHTML? We were supposed to be able to use other markup languages, such as MathML and SVG, but 1) just because you can import tags doesn't mean the browser will provide any default rendering for them, and 2) browsers already support the more popular markup such as SVG even in plain old HTML mode.

    If all we want is just the strict syntax -- lowercase tags, quoted attributes, optional closing tags nonetheless closed, etc -- then it seems all we really need is a linter.

    Also, keep in mind that unless you're serving your pages as application/xhtml+xml -- which virtually no one actually is -- then you're not actually using XHTML. It doesn't matter even if your doctype says XHTML. If you serve it as text/html, then the browser is treating it as plain old HTML, and all those self-closing slashes aren't really doing anything at all.
    "First make it work. Then make it better."

  7. #7
    SitePoint Guru bronze trophy TomB's Avatar
    Join Date
    Oct 2005
    Location
    Milton Keynes, UK
    Posts
    988
    Mentioned
    9 Post(s)
    Tagged
    2 Thread(s)
    XHTML did do something good... it made web pages which were readable by standard XML parsers. IMHO that was a good thing... HTML5 without the same level of strictness makes it needlessly more difficult, which is a shame.

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,600
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Jeff Mott View Post
    Also, keep in mind that unless you're serving your pages as application/xhtml+xml -- which virtually no one actually is -- then you're not actually using XHTML.
    That's because there are still too many people using IE8 which doesn't support XHTML. Once IE8 dies out then it will become possible to use XHTML. At that point some people may start actually using it (or they may not - we'll have to weait and see how popular it becomes).

    Anyway XHTML doesn't look like it is going to die out soon. The new XHTML 5 version is expected to become a standard next year at about the same time HTML 5 does.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,149
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Once IE8 dies out then it will become possible to use XHTML.
    Which brings me back to my question, "Is there even any practical benefit to XHTML?" If we could use true XHTML, then what could we do in XHTML5 that we can't do in HTML5?
    "First make it work. Then make it better."

  10. #10
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,600
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Jeff Mott View Post
    Which brings me back to my question, "Is there even any practical benefit to XHTML?" If we could use true XHTML, then what could we do in XHTML5 that we can't do in HTML5?
    In those browsers that follow the rules it will be easier to detect some errors in the XHTML - since the page will only display up to the point where the error occurs. You will not have different browsers making potentially different assumptions as to how to handle the error in the code.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  11. #11
    SitePoint Member
    Join Date
    Oct 2013
    Location
    Texas, USA
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should use according to your requirements but if you're looking for the best one then use HTML5 cause it's the latest version of HTML and as well as support all the feature of HTML. the functionality would be remain almost same but you can enjoy the different features of it.

  12. #12
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,600
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Clickpencil2 View Post
    use HTML5 cause it's the latest version of HTML
    HTML is not the latest version of HTML yet - it will be next year when it becomes a standard but at the moment HTML 5 and XHTML 5 are still in development and subject to change.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  13. #13
    SitePoint Member kamruzzaman's Avatar
    Join Date
    Oct 2013
    Location
    Dhaka
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes we can user HTML 5. but html5 is not all browser support. don't worry any browser we can support html5 by using css, jquery.


Tags for this Thread

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
  •