SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  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,830
    Mentioned
    25 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 Evangelist WebMachine's Avatar
    Join Date
    Jun 2007
    Location
    Ontario, Canada
    Posts
    412
    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
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 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,276
    Mentioned
    18 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
    989
    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,830
    Mentioned
    25 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,276
    Mentioned
    18 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,830
    Mentioned
    25 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,830
    Mentioned
    25 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.

  14. #14
    SitePoint Member
    Join Date
    Jun 2014
    Posts
    2
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Time has passed

    Since that discussion took place.

    Now what many people forget is the SEO part of any version of Html.
    IMO Html is the biggest tool one has at his fingertips to push a site up in ranking. Cms, something not mentioned here is all about the SEO friendly structure.

    OK those systems can have a SEO friendly domain extension and have even an Alt tag. but there are more tags to a site and there are more names to folder, images (which can also be named before uploading) and else what can be done on html. For a good SEO you need to know how a spider sees your site. True now with panda 4 content has a bigger percentage but that is a lesser problem in html.

    For any smaller site you need to find out what your regional clients have as browsers, where I live Iexplorer 8 is kind of advanced. A larger site like 20 to 100 pages in dimension php is way better than CMS.

    Specially when trying to get people without much knowledge into designing their own sites CMS has quiet a few short comings, one mistake, one change of an image and the site looks so different people regret having even looked at CMS. Cms is sold as the new site develop software even so it just gives the designer a way shorter development time, kind of cheating IMO.

    CMS is not the issue here the question is "Should I use HTML5 or XHTML" ?

    Well have a look into your servers user stats and see what kind of browser they are using to browse through your site. That would give you a nice picture. You could also try to use a system where you have browsers like Iexporer6 just to see if the browser garbles your site out in a way no-one in his mind would allow that to happen to his site. You can mix even both styles and see how it is interpreted. A spider has a very different way seeing stuff, it crawls through our sites and decides what is good content and what is not. Those critters read tags more than Html5 allows and like tags even more than flashy images.

    Lets have a look at your site surely by now it has been finished how have you decided?

  15. #15
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,830
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by arnego2
    CMS is not the issue here the question is "Should I use HTML5 or XHTML" ?
    No the question should be "Should I use HTML5 or XHTML5" - the answer to which currently depends on whether or not you need to support IE8.
    Last edited by ralph.m; Jun 9, 2014 at 15:23.
    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="^$">

  16. #16
    SitePoint Member
    Join Date
    Jun 2014
    Posts
    2
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If I'm not mistaken that is what I said. Sure quite late at the end of my Rant vs CMS customization, wouldn't you agree?

  17. #17
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by arnego2 View Post
    If I'm not mistaken that is what I said
    Not quite. Notice the 5 on the end of felgall's comment. That makes it quite a different question.

    Quote Originally Posted by felgall
    "Should I use HTML5 or XHTML5"

  18. #18
    SitePoint Member XxCrashxX's Avatar
    Join Date
    Jun 2014
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Honestly, if you can't decide on which one you want to use, try out both for about an hour each. I prefer HTML5, but I have no experience with XHTML.


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
  •