HTML vs XHTML what is the difference?

Discussion in 'HTML & Website Design' started by jaredgravatt, Jan 3, 2008.

  1. #1
    Hi Everyone.

    I am in the process of learning HTML. What is the difference between this and XHTML? and would I be better learning one over the other?
     
    jaredgravatt, Jan 3, 2008 IP
    rapidsharelinks likes this.
  2. UKWebmasterForum

    UKWebmasterForum Guest

    Messages:
    477
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    XHTML is simply HTML which also conforms XML within it's code.
     
    UKWebmasterForum, Jan 3, 2008 IP
  3. jaredgravatt

    jaredgravatt Active Member

    Messages:
    849
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #3
    So learn Html first?
     
    jaredgravatt, Jan 3, 2008 IP
  4. tushardhoot1

    tushardhoot1 Active Member

    Messages:
    3,013
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    90
    #4
    HTML would probably be simpler.
     
    tushardhoot1, Jan 3, 2008 IP
  5. OSWebMaster

    OSWebMaster Guest

    Messages:
    71
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hello -

    You should learn XHTML first, because that is the way it is going. The W3C.org, that sets the standards is simultaneously stating that they are phasing out HTML in favor of XHTML (if you read the page about XHTML), and also considering a move to HTML 5.0 (current version is HTML 4.x), which will (they have to hash things out over there with a number of big players like Apple, Google, Mozilla, MS, etc. weighing in) include the (X) part of XHTML, which stands for eXtensible.

    Think about it like this... a number of web 2.0 applications depend on the abilities of XHTML. It is part of the future. Also, it is not much different than HTML. We have a couple of tutorials on it at WebHelperMagazine.com

    Scott Frangos, Managing Editor - WebHelperMagazine.com
     
    OSWebMaster, Jan 3, 2008 IP
  6. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Like what? Because anything that depends on XHTML abilities means it doesn't work in IE. There are no special abilities of XHTML (that I know of) that you can get while serving it as "text/html", which tells everyone, "This is just an HTML document."

    Unless you're building web pages for non-IE only, Jared, and need your page to be an XML document, you'll be calling it text/html anyway.

    Yeah, W3 really wanted people to switch over because it was supposed to be better than HTML4 but without IE support, the point is moot. In my country, IE use is about 90% : ( Firefox is only about 9% and everyone else is uner 1%. I write XHTML, but I shouldn't, cause it's just strict plain ol HTML anyway.
     
    Stomme poes, Jan 3, 2008 IP
  7. UKWebmasterForum

    UKWebmasterForum Guest

    Messages:
    477
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You are wrong about XHTML phasing HTML out, XHTML is simply HTML which conforms the XML syntax nothing else. XHTML = HTML + XML - nothing more.
     
    UKWebmasterForum, Jan 4, 2008 IP
  8. OSWebMaster

    OSWebMaster Guest

    Messages:
    71
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Hello -

    Stomme poes -- you asked what in web 2.0 depends on the "X" in XHTML? Well, a number of current "social" web applications depend on it. I think you will agree that AJAX is an important part of the wizardry behind many "Web 2.0" sites? Well... guess what? The "X" in AJAX stands for XHTML... and there's a reason why it's not an "H".

    UKWF -- I know what you mean that XHTML is the next step up, but consider this from the W3C.org's official page on XHTML:
    "The Extensible HyperText Markup Language (XHTMLâ„¢) is a family of current and future document types and modules that reproduce, subset, and extend HTML, reformulated in XML. XHTML Family document types are all XML-based, and ultimately are designed to work in conjunction with XML-based user agents. XHTML is the successor of HTML, and a series of specifications has been developed for XHTML."

    Also, take a look at this article on the respected "AListApart" Blog which states: "XHTML is the standard markup language for web documents and the successor to HTML 4."

    Thanks for the conversation.

    Scott
     
    OSWebMaster, Jan 4, 2008 IP
  9. UKWebmasterForum

    UKWebmasterForum Guest

    Messages:
    477
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thanks for the links :).
     
    UKWebmasterForum, Jan 4, 2008 IP
  10. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #10
    1. There is no such thing as web 2.0

    2. How on EARTH do web applications depend on the X in HTML when they're using improper XHTML in the first place? 98% of web pages using an XHTML Doctype are sending a MIME type of text/html, which means they're not even using XHTML in the first place, and are NOT using the little "X" in XHTML.

    3. Wizardry? XMLHttpRequest == Wizardry?!!!. It's been around since 2002ish and AJAX is only a little buzzword. Just because it sounds cool doesn't necessarily mean you should support it and use it.

    4. Sorry, you haven't been keeping up. Those statements were typed about 4-6 years ago (ALA Article date - 2002. Today's date - 2008) .

    Btw: We all know who ALA is, and anyone who doesn't shouldn't call themselves a developer.

    Why would you support XHTML if XHTML 2.0 isn't even backwards compatible? And why would you support XHTML if it isn't even supported by the worlds most popular browser?

    Are you even aware that the W3 has a working group on HTML 5? There's even a draft available on w3.org. No one is really thinking all that much about XHTML 2 nowadays.

    Thanks for the conversation.

    Soulscratch


    P.S.

    http://webhelpermagazine.com/
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    That means you're not using XHTML. It means you're sending your document as text/html (same as HTML 3.2). So, while you have "ALMOST VALID XHTML (Failed validation, 60 Errors)", you are not even using XHTML. And if you did use REAL XHTML, you would get an error saying your syntax is not correct, and your page would not render.

    That's one of the reasons why I choose HTML 4.01 Strict, because I can send it in its REAL and proper form (MIME type of text/html) and not have to deal with the draconian error handling of XHTML.
     
    soulscratch, Jan 4, 2008 IP
  11. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #11
    XHTML addresses a number of things I always disliked about HTML - like closing tags being optional on block levels - unfortunately it does so at the cost of making you close ALL tags, even ones that would NEVER have content inside them, which is a bit #DDD. It forces a structure mechanism, that combined with PROPER ****ING USE OF THE TAB KEY helps a good deal with making code clearer and easier to maintain, and teaches good structure habits. (Though good coding habits really take another type of habit to help develop - a nun screaming in one ear "INDENT" ****WHAP**** across the knuckles with a ruler, followed by "DEINDENT" ****WHAP**** across the knuckles)

    THOUGH, AGAIN with this "if you don't serve it as XHTML it's not XHTML" rubbish. Bullshit, utter and total. It says right in the XHTML 1.0 spec that it can be served as EITHER. 1.1, sure, don't feed that as text/html - but just because you are feeding it as text/html does NOT make XHTML 1.0 magically not be XHTML. Sorry, BULLSHIT.

    Either way, HTML or XHTML, use a strict doctype - those tags and attributes that are 'deprecated' were yoinked for a REASON - and don't try to replicate them with javascript - you see that with 'target' all the time... **** target, you should NEVER change the default behavior of a link that way. If I want it in a new window, I'll open it in a new window myself... otherwise, LEAVE THAT ANCHOR THE **** ALONE!!!
     
    deathshadow, Jan 4, 2008 IP
  12. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #12
    http://www.w3.org/MarkUp/2004/xhtml-faq

    Why is it allowed to send XHTML 1.0 documents as text/html?

    XHTML is an XML format; this means that strictly speaking it should be sent with an XML-related media type (application/xhtml+xml, application/xml, or text/xml). However XHTML 1.0 was carefully designed so that with care it would also work on legacy HTML user agents as well. If you follow some simple guidelines, you can get many XHTML 1.0 documents to work in legacy browsers. However, legacy browsers only understand the media type text/html, so you have to use that media type if you send XHTML 1.0 documents to them. But be well aware, sending XHTML documents to browsers as text/html means that those browsers see the documents as HTML documents, not XHTML documents.

    In addition, with hixie's , anne's, henri's and tommy olsson's opinions I choose to not use XHTML.
     
    soulscratch, Jan 4, 2008 IP
  13. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #13
    No, the X is XML. Asynchronous Javascript And XML. You can use AJAX with plain old HTML-- we do it at our work all the time!! (with crappy 1997-style pages which often don't even have a doctype OR an opening HTML tag!!! Yeah, I didn't get to those ones yet).
    The web page itself can have a bunch of XML stuff ON it-- why do you think HTML4 sites can have RSS?? That's XML documents right there. No wizardry here, just our sweat and time : )

    Though if XHTML could force people to write more sctrictly and semantically, I'd be pushing everyone to use it (or try). But, it doesn't.

    Oh and I was thinking of Jared's original quesion-- the question isn't, which should I learn first? That's more like asking, should I learn Castillian Spanish or Mexican Spanish? They have a few very important differences, but if you learn one, you know 95% of the other anyway. Don't let anyone fool you into thinking it's "Which should I learn first, Dutch or German?" They're not that different.
     
    Stomme poes, Jan 5, 2008 IP
  14. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #14
    The X in Ajax is irrelevant anyway, because you don't necessarily have to rely on an XML file.
     
    soulscratch, Jan 5, 2008 IP
  15. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #15
    It having a new name is in and of itself is bullshit, as it bears a striking resemblance to FPD (frame passed DATA) which is little more than overglorified DHTML... which used to be called CGC (client side generated content) Ooh, we're calling a handful of "new" javascript commands, let's give an existing method a whole new ****ing name. (yes, you CAN do a lot of what is done via ajax using a scripted iframe that uppasses it's values to the parent page)

    Mind you, I say the same thing about SSI/CGI/SGC, or the whole virtualization/emulation/JIT/bytecode interpreter which is why you'll sometimes see me append the acronym PAFNA. Pick A ****ing Name Already.
     
    deathshadow, Jan 5, 2008 IP
  16. cff

    cff Active Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    53
    #16
    You should learn HTML and XML. Then XHTML will came naturally.
     
    cff, Jan 7, 2008 IP
  17. webgal

    webgal Peon

    Messages:
    533
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I usually use shtml so I can have include files. It maybe that something else allows it (rather not go the asp route).
     
    webgal, Jan 7, 2008 IP
  18. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #18
    Any SSI/CGI/SGC/PAFNA will let you do that - SHTML, ASP, and PHP top the list, but other more traditional CGI's work too like PERL and PYTHON.

    for example:

    SHTML:
    <!--#include virtual="test.html" -->

    PHP:
    <?php include('test.html'); ?>

    ASP:
    <!--#include file="test.html"-->

    are all pretty much the same thing. Of course, in PHP you should probably already have the php 'opened' and not go nuts putting <?php ?> two or three times on every line like some nutjobs do. (I still say you open and close php more than once in a file, you are probably doing something wrong - that's what ECHO is for)
     
    deathshadow, Jan 7, 2008 IP
  19. OSWebMaster

    OSWebMaster Guest

    Messages:
    71
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Hello All -

    Good discussion. Some points in response to the debated items:
    • Yes, I'm aware that W3C.org is working on HTML 5. From their draft dated Oct. 07 (closer to 2008 SoulScratch), "The HTML 5 language has a "custom" HTML syntax that is compatible with HTML 4 and XHTML1 documents published on the Web..." I take this to mean that the "X" is still in there. Here's another quote from the same document: "The other syntax that can be used for HTML 5 is XML. This syntax is compatible with XHTML1 documents and implementations." Reference link: http://www.w3.org/html/wg/html5/diff/
    • Why would I support XHTML? I think that the XHTML group will fuse with the HTML 5 group (that started in a separate organization -- see, I have been "keeping up"), now that the W3C.org has corralled both groups. In other words, while I don't see them releasing BOTH XHTML 2, and HTML 5; I DO see them releasing one upgrade that includes the "X factor."
    • There is indeed a Web 2.0, unless you would deny all of the search results here: Google for "define: Web 2.0"
    • In case you are still wondering what I meant about Web 2.0 being powered as a result of the "X" in AJAX, and XHTML, where X stands for "eXtensible," consider this definition: "a phrase coined by O'Reilly Media in 2004, refers to a perceived second-generation of Web-based services—such as social networking sites, wikis, communication tools, and folksonomies—that emphasize online collaboration and sharing..." You can argue with the "perceived" part of the definition, if you like, but I submit that the "X" enables a lot of what is being defined here.

    - Scott
     
    OSWebMaster, Jan 9, 2008 IP