SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XHTML & CSS2 or HTML5 & CSS3

    Hi

    Sorry if this has been asked before, had a quick search and found nothing!

    Basically, I've dabbled in web design before but never really understood HTML+CSS fully. I want to properly learn it now so that I am able to make simple static websites without thinking about it.

    Am I best off learning XHTML & CSS2 getting used to basics, then picking up HTML5 & CSS3 or should I start with HTML5/CSS3 straight away?

    Cheers!

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by lolage View Post
    Am I best off learning XHTML & CSS2 getting used to basics, then picking up HTML5 & CSS3 or should I start with HTML5/CSS3 straight away?
    Much better to start with HTML and CSS2, as the others are really just additions to that, rather than a whole new thing. And both HTML5 and CSS3 are still in development and changing all the time, so not very reliable at this stage. They are nice icing on the cake, as it were, but icing with no cake is not much use.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Much better to start with HTML and CSS2, as the others are really just additions to that, rather than a whole new thing. And both HTML5 and CSS3 are still in development and changing all the time, so not very reliable at this stage. They are nice icing on the cake, as it were, but icing with no cake is not much use.
    Cool, cheers.

    So just not bother with XHTML either?

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,598
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by lolage View Post
    So just not bother with XHTML either?
    There is very little difference between HTML 4 and XHTML 1.0 so learning either one is effectively the same thing (the differences are not significant until you actually serve the XHTML as XHTML instead of HTML and that doesn't work in IE8 and earlier).

    HTML 5 recognises that these are that close to the same thing by incorporating both in (X)HTML 5.
    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="^$">

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    XHTML and HTML are basically the same thing. You can just get away with being a little more sloppy with HTML than XHTML, but no one says you have to be sloppy. For example, XHTML insists that you close tags like </li>, which you can get away with not doing that in HTML. But I do it anyway, so there's no difference ... except that in XHTML you have some extra closing slashes that I find ugly, such as <img scr="" alt="" />.

    The other problem with XHTML is that most Microsoft browsers don't actually support it (from IE8 and backwards). So you just have to serve it up as HTML anyway. There's a useful thread comparing them here:

    http://www.sitepoint.com/forums/show...ML-vs-HTML-FAQ

    Given that HTML5 is on the horizon, I consider XHTML to be a dead-end street (even though there's an acknowledgement of its rules in HTML5). Its usefulness was that it encouraged better coding practices—something that will be sorely needed with HTML5, which has gone back to allowing sloppy code.

    Edit:

    Beaten to it.

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you both for your input!

  7. #7
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,598
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ralph.m View Post
    <img scr="" alt="" />
    Coding that way indiccates a lack of understanding of the difference between HTML and XHTML. The space before the slash is needed if you are writing HTML for Netscape 4 using the XHTML rules. XHTML doesn't need that space and all browsers more recent than Netscape 4 don't need it even when the page is still served as HTML.

    If you are following the XHTML rules that should be coded as:

    <img scr="" alt=""/>
    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="^$">

  8. #8
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    656
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Given that HTML5 is on the horizon, I consider XHTML to be a dead-end street (even though there's an acknowledgement of its rules in HTML5). Its usefulness was that it encouraged better coding practices—something that will be sorely needed with HTML5, which has gone back to allowing sloppy code.
    Case in point why W3C should be disbanded. Killing XHTML was a stupid a** decision.
    Chuck Norris is so tough, mosquitos ask for permission before they bite him

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by felgall View Post
    The space before the slash is needed if you are writing HTML for Netscape 4 using the XHTML rules. XHTML doesn't need that space and all browsers more recent than Netscape 4 don't need it even when the page is still served as HTML.
    Thanks felgall. I kind of had an inkling from somewhere the space was no longer needed, but, having long forgotten about xhtml, I haven't reformed (until now ).


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
  •