Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 3 123 LastLast
Results 1 to 10 of 26
  1. #1

    Default [HTML Guide] HTML or XHTML

    HTML or XHTML
    Many people favour XHTML over HTML because they believe that it is the future and to a degree they are correct, but there are some drawbacks they must understand before they go rushing off into coding XHTML. Some of these include content type, null end tags, internet explorer incompatibility, and other problems. I’m aware this is a lengthy read but anyone who wants to be knowledge in developing websites it is worth it.


    Beliefs of XHTML
    Many people believe that XHTML is superior to HTML, in which it does have some beneficial features, but people often push forwards beliefs that XHTML does things that HTML doesn’t, and the following are incorrect. XHTML does not;

    • XHTML does not allow a greater separation of content and presentation than HTML.
    • XHTML does not have more elements and attributes than HTML.
    • XHTML doesn’t give any extra CSS features than HTML.
    • XHTML isn’t as equip for the future than HTML, as XHTML 2.0 won’t be backwards compatible where as HTML 5 will.
    • XHTML does not have good browser support.
    • XHTML source isn’t essentially cleaner than HTML source


    Content Type
    Everything has a content type, GIF has "image/gif", PNG has "image/png", CSS has "text/css", Javascript has "text/javascript" etc. So does HTML and XHTML but they’re not the same much like images content types. HTML has the content type "text/html" where as XHTML has the content type "application/xhtml+xml" but there’s more to it than simply the content type.

    XHTML Being Sent as HTML
    Majority of web servers sends your page as text/html by default, even ".php" extension files are sent as "text/html", so if you have a page that has XHTML mark-up and is ".php" extension unless you’ve specified a header it will be sent to the user’s browser has "text/html". What will this mean? Well this means that your XHTML will be interrupted as HTML! Now what effects will this have? Well firstly this will result in the browser rendering your XHTML as ‘broken HTML’ such that if you used "<br />" it will simply presume that the trailing slash "/" is an error, and corrects it to be "<br>". This will mean that the XHTML mark-up as broken HTML, which will practically eliminate any beneficial XHTML features.

    XHTML Being Sent as XHTML
    So you understand that your XHTML is being sent as HTML so you want to correct this, you can do it via a number of ways, one of which is not the meta tag. You can either change the server configuration to send it as "application/xhtml+xml" or you can use a server-side language to send the headers for example in PHP if you put at the top of the page
    Code:
    header("Content-type: application/xhtml+xml");
    this will change the content type. But you’ve got to understand by doing this will you have an adverse effect on Internet Explorer! Typical, I know. Internet Explorer up to this date still does not support the XHTML content type, and so when you send it as "application/xhtml+xml" it will simply ask how to open your page.


    Null End Tags
    If you didn’t already know in XHTML everything must be closed, such example is "<br>" will become "<br />", which will close it. Null End Tags is a feature in HTML which you can use "/" to close a element such example is "<p/Paragraph/" which is 100% valid in HTML 4.01 Transitional, although it is not the best practice. The first slash signifies the closing of the opening paragraph tag, the second slash is the closing paragraph tag. So if you use "<br />" in XHTML and its rendered as HTML in a browser that supports null end tags, it will render it as "<br /" with "<" as text, this is because the forward slash closed the "br".


    Compatibility Guidelines
    XHTML 1.0 had the idea to allow people to send their documents as "text/html" by following guidelines, and this is why it’s seen as valid when sent as "text/html". The whole idea of this was to allow people and browsers to change from HTML to XHTML more easily, but many people believe this was a mistake. They believe it as a mistake because many sites that are developed under this compatibility guideline would break if they were treated as XML (as that’s the whole point of XHTML to be an XML alternative to HTML). So by believing that by following the HTML compatibility guidelines and validating your document will ensure it to compatible for both HTML and XHTML are mistake. Because if you use a single self-closing tag like "<br />" that automatically creates incompatibilities between the two specifications.


    Other problems
    XHTML is often supported in many browsers, one being Firefox, but the performance of XHTML based websites (with the XHTML content type) in versions of Firefox 2.0 and below is considerably worse than HTML. This is because Firefox 2.0 and below renders XHTML once the entire page has been loaded, and it’s checked that the mark-up is well formed, unlike HTML. HTML uses what is called incremental rendering, which means that it will start rendering the page as soon as it gets it. Besides that you also have the fact that Internet Explorer does not support the "application/xhtml+xml" content type as already stated which eliminates over half of your viewers.


    Conclusion
    XHTML is a great thing and has many promising features, although it currently isn’t supported enough in the correct form and to make a browser render it as HTML is against everything XHTML is. Presuming you want to make your website available to the greatest number of viewers, you can only chose to use XHTML incorrectly. So if you have no real use for the XHTML benefits like SVG and MathML then you should use HTML 4.01 Strict as it’s what most browsers and search engines are used to and there is nothing wrong with using it, It is in fact a World Wide Web Consortium recommendation. But in the end it’s up to you. Well you’ve reached the end of this lengthy post; forgive me for any spelling mistakes and I hope this has broaden your knowledge on what to chose.
    Last edited by Iszak; 09-11-2008 at 11:15 AM.

  2. #2
    Join Date
    May 2008
    Location
    Bristol!
    Posts
    252
    Tokens
    0

    Default

    Great tutorial Iszak hopefully it will help people!

  3. #3
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    I'm sorry I prefer full PHP with no tables.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  4. #4

    Default

    Never using tables isn't exactly the smartest thing to do, you're meant to use tables when appropriate - for tabular data. Not to mention this guide doesn't even mention tables once so I don't know where you got that from.

  5. #5
    Join Date
    Aug 2008
    Posts
    206
    Tokens
    0

    Default

    So the point of that is..
    Use HTML, not XHTML

    Merged by Meti (Forum Moderator): Due to forum lag
    Last edited by Meti; 09-11-2008 at 08:15 PM.

  6. #6
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    2,015
    Tokens
    568

    Latest Awards:

    Default

    Quote Originally Posted by Iszak View Post
    Never using tables isn't exactly the smartest thing to do, you're meant to use tables when appropriate - for tabular data. Not to mention this guide doesn't even mention tables once so I don't know where you got that from.
    I believe he was referencing a comment that Darren made a while ago.
    Just nod along

  7. #7
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    What do you expect from "know-it-all" new kids to the block trinity... honestly.

    Everyone on this forum uses HTML anyway, so this is completly useless as the correct specs for XHTML will be released in years to come as new browsers slowly update and improve on XHTML rendering capabilities.


    www.fragme.co = a project.

  8. #8
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    This is a good guide +rep If I can.
    Quote Originally Posted by Jewish Bear View Post
    I'm sorry I prefer full PHP with no tables.
    Was this meant to be a dig at DarrenToogood?
    Lets set the stage on fire, and hollywood will be jealous.

  9. #9
    Join Date
    Mar 2007
    Posts
    1,691
    Tokens
    1,025

    Latest Awards:

    Default

    Okay here's the problem! You've written the guide in such as way that only people who already know the facts will understand it. Simplify it for god sake :|

  10. #10
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    Valid point greg, no offense to the developers on this forum but an "idiots how-to" version would be good for the newer people to the scene.


    www.fragme.co = a project.

Page 1 of 3 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
  •