Author Topic: HTML or XHTML  (Read 3286 times)

0 Members and 1 Guest are viewing this topic.

Offline Fish

  • Jr. Member
  • **
  • Male
  • Posts: 69
HTML or XHTML
« on: November 07, 2005, 01:33:23 pm »
(Sorry if this is in te wrong place.  I wasn't sure where to put it.)

Ok.  I'm delving back into coding alsorts of late and I thought it'd be good to finally get a good web-authoring language under my belt.  I used to know a bit of HTML but that was ages ago and I've forgotten what little I know.  But now XHTML, is coming into a wider use and I'm not sure if I should go with HTML or XHTML.  I think XHTML is better but I'm not wholly sure. Maybe it's better to start on HTML and progress to XHTML.  I just don't know.

Any advice would be appreciated.

Oh.  I'm learning C++ at the moment so it's not like I can't cope wit beefy coding or anything.  That's more fun than it is offputting.

Thanks. ^_^





Offline Lavender

  • Sr. Member
  • ****
  • Male
  • Posts: 424
    • The ole furtopia site, desperately needs updating
HTML or XHTML
« Reply #1 on: November 07, 2005, 06:08:14 pm »
Short answer: HTML.

XHTML's a pain.

Offline Tabuu

  • Hero Member
  • *****
  • Male
  • Posts: 809
    • http://tabuu-lion.artistsworld.org
HTML or XHTML
« Reply #2 on: November 27, 2005, 09:28:08 am »
Quote (Lavender @ Nov. 07 2005, 5:08 pm)
Short answer: HTML.

XHTML's a pain.

XHTML is a pain, but it gives you more definite and stable results. It has a lot of rules to trip up those who have developed bad coding habits, and is totally barebones. It's just about presenting the data clearly and plainly, where all the coloring/designing/fancy stuff is taken care of through Cascading Style Sheets (CSS).

I recommend it highly, though, if you are willing to learn CSS along with it or already have knowledge of its function and structure. XHTML is becoming standard either, because the old outdated HTML everyone likes or has become accustomed to using is filled with attributes and tags that are browser specific. Gives butchered results if you use the wrong client.

It's not hard to learn. It's just tedious, and that's mostly the breaking "bad habits" part, "coding in lowercase only", "using /> inside standalone tags to close them properly", and "change element colors/size/alignment with css instead of html attributes". W3Schools.com taught me all I needed to know about it, and I was fluent with it before five days had passed after recoding a page in xhtml.

If you ever plan on making future webpages (or webpages that will work in the near future) it would likely be best to get used to the XHTML standard now than have to learn it and recode your page later when everything is all broken.




|| Trades - OPEN! || Request - Considering A Few... || Commissions - Not that good yet -_- ||

|| DA || ArtistsWorld ||

Offline Nocte

  • Hero Member
  • *****
  • Male
  • Posts: 1689
    • http://unicorn.furtopia.org/
HTML or XHTML
« Reply #3 on: November 27, 2005, 12:45:46 pm »
Indeed; XHTML doesn't let you get away with sloppy writing, so it is a pain for those that are used to writing "tag soup".

The biggest advantage is that XHTML+CSS is more compact than HTML, so your page loads faster (especially if you use the same CSS for multiple pages).

Also, you can use XML tools, and mix it cleanly with other XML documents (MathML, SVG), but that's only nice to have, not a big reason to switch.
Drawing tutorial
Avatar information
FEHu3a A+ C D-- H M- P R++ T W-- Z Sm- RLCT a cl++++ d+ e+++ f- h+++ i++ j p sm*

Offline Mister Initial Man

  • Sr. Member
  • Species: Lynx/Bear
  • ****
  • Male
  • Posts: 401
    • The Lynx's Den
HTML or XHTML
« Reply #4 on: December 05, 2005, 01:48:55 pm »
I feel I have to toss in my two cents.  I would like to refute a few things, and I ask that you understand that I do this with all due respect to the board and all who have spoken.

Quote
XHTML is becoming standard either, because the old outdated HTML everyone likes or has become accustomed to using is filled with attributes and tags that are browser specific. Gives butchered results if you use the wrong client.


XHTML is becoming the standard, but it's NOT the standard yet.  HTML is old, but it is not outdated..  Parts of it (such as <font>, <marquee>, and <blink>) are, but these are easily replaced with CSS (except for marquee, which was tossed out entirely).  If you code in completely valid HTML, you won't get butchered results.  How do you know you have good HTML?  First step is to give it the HTML 4.01 Strict Doctype:  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"   "http://www.w3.org/TR/html4/strict.dtd">  The World Wide Web Consortium's validator can be found here.

Quote
It's not hard to learn. It's just tedious, and that's mostly the breaking "bad habits" part, "coding in lowercase only", "using /> inside standalone tags to close them properly", and "change element colors/size/alignment with css instead of html attributes". W3Schools.com taught me all I needed to know about it, and I was fluent with it before five days had passed after recoding a page in xhtml.


You can do everything mentioned above with HTML 4.01 except for one thing: "using /> inside standalone tags to close them properly".  That is for XML (which includes XHTML) alone.  HTML 4.01 does not allow that.

Quote
If you ever plan on making future webpages (or webpages that will work in the near future) it would likely be best to get used to the XHTML standard now than have to learn it and recode your page later when everything is all broken.


You'll have to recode eventually, when HTML is completely historical, supported by no browser.  If you've already changed things over to perfect HTML 4.01 Strict, you won't have much to do. There will be the aforementioned />'s at the end of empty elements, and some elements may be unsupported by that time, but those are elements you can't do without right now.  However, when this happens, it means Internet Explorer will have pulled its socks up, and fully supports all W3C standards.  What I'm saying is, relax, you've got years.

Quote
Indeed; XHTML doesn't let you get away with sloppy writing, so it is a pain for those that are used to writing "tag soup".


I'm afraid I have to disagree.  You can have a perfectly valid XHTML web page, but have everything laid out with tables, control font sizes with <span style=""> or <div style="">, and you're back to tag soup.  And XHTML 1.0 will give results on a browser even if there are mistakes in coding, if it's sent as text/html.  Which it usually - and incorrectly - is.

Quote
The biggest advantage is that XHTML+CSS is more compact than HTML, so your page loads faster (especially if you use the same CSS for multiple pages).


HTML+CSS is just as compact.  HTML 4.01 has thye <link> element, which you can use to link one CSS page to as many pages as you please.  XHTML 1.0 has no real advantage there.  There IS an XHTML 2.0, which is even more streamlined, but Internet Explorer won't even touch it.  And that's about 80% of your population.



There's a couple of excellent articles on it written by a good friend of mine about XHTML. The (X)HTML Files, and HTML and XHTML revisited.

Do you REALLY need to use XHTML?  Are you going to be doing content-negotiation (like turning your content into a PDF file?) or bringing in MathML or SVG?  Note: Neither of those languages are supported by Internet Explorer.   If not, go for HTML 4.01, you can break bad coding habits there.

If you DO use XHTML, remember it is XML, and needs an XML declaration, not just the XHTML doctype.  You also have to remember that Internet Exploder will choke on XHTML if you do it properly - which is why it doesn't support MathML or SVG.

Warning:  Internet Explorer chokes on a LOT of things, including certain parts of CSS (and I'm not talking the cutting edge CSS3 ':p' ).

Go for HTML 4.01.  XHTML is the markup language of the future, true.  This, however, is the now.





Offline Nocte

  • Hero Member
  • *****
  • Male
  • Posts: 1689
    • http://unicorn.furtopia.org/
HTML or XHTML
« Reply #5 on: December 08, 2005, 06:14:42 am »
Quote (Mister Initial Man @ Dec. 05 2005, 7:48 pm)
I'm afraid I have to disagree.  You can have a perfectly valid XHTML web page, but have everything laid out with tables, control font sizes with <span style=""> or <div style="">, and you're back to tag soup.  And XHTML 1.0 will give results on a browser even if there are mistakes in coding, if it's sent as text/html.  Which it usually - and incorrectly - is.

True, it is possible to use XHTML in this way. What I meant was that a lot of the old HTML tricks no longer work, and you're forced to learn/use CSS for it (either external or in a style attribute). XHTML is a pain, in the same way as 4.01 Strict.

I was also thinking of closing all tags, mixing upper and lowercase, quoting attributes with apostrophes (or not at all)...; HTML will still let you get away with that, XHTML is very strict in this (although browsers will still accept it if it's not properly treated as an XML document).

And yes, it's unfortunate that the bulk of XHTML is still sent as text/html. For those who use PHP, you can experiment with setting the proper headers for browsers that support it:
Code Sample
<?php
if (stristr ($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
  header ("Content-type: application/xhtml+xml");
} else {
  header ("Content-type: text/html");
}
?>


Quote
HTML+CSS is just as compact.  HTML 4.01 has thye <link> element, which you can use to link one CSS page to as many pages as you please.

You're right. I was still thinking of old-school HTML. '<img'>
Drawing tutorial
Avatar information
FEHu3a A+ C D-- H M- P R++ T W-- Z Sm- RLCT a cl++++ d+ e+++ f- h+++ i++ j p sm*

Offline Mister Initial Man

  • Sr. Member
  • Species: Lynx/Bear
  • ****
  • Male
  • Posts: 401
    • The Lynx's Den
HTML or XHTML
« Reply #6 on: December 08, 2005, 09:44:38 am »
How old school?  I mean, this is REALLY old-school HTML:

Code Sample
<html>
<head>
<title>Picture</title>
</head>
<body>
<img src="mypicture.jpg">
</body>


'<img'>

I know what you mean though, with the <font> tags, and tables for layout, and such neat visual effects as <marquee><blink>.  That tends to get rather, ahhh...  bloated?





Offline Benjamin

  • the admin liger
  • Species: liger
  • *
  • Male
  • Posts: 3907
    • stripeymaney
HTML or XHTML
« Reply #7 on: December 12, 2005, 02:09:05 pm »
HTML itself is so widespread that I can't foresee it being abandoned altogether. It would be rather foolish to eliminate it, since so many programs and sites rely on it... and simple, old school html makes the web more accessible for the less technically-inclined.
 
Benjamin

Offline Tabuu

  • Hero Member
  • *****
  • Male
  • Posts: 809
    • http://tabuu-lion.artistsworld.org
HTML or XHTML
« Reply #8 on: December 13, 2005, 07:41:53 am »
Quote (Nocte @ Dec. 08 2005, 5:14 am)
Quote
HTML+CSS is just as compact.  HTML 4.01 has thye <link> element, which you can use to link one CSS page to as many pages as you please.

You're right. I was still thinking of old-school HTML. '<img'>

I'll raise a hand to that too. Hasty misconception on my part e.e

Also, as per a quote from the w3.org XHTML faqs, they know perfectly well XHTML 1.0 is compatable with legacy browsers, while future versions aren't so welcoming of it. It was intentional.

Quote
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.


Pretty much meaning you can go as deep as 1.0 and just consider yourself ahead of the game without worry, unless you're an absolute purist that fears being frowned upon. It just doesn't hurt if you wish to be a little more advanced and prepared. Like MIM said, though, it isn't absolutely necessary to learn right now. But sometime. I'm just a sooner-rather-than-later person. Whatever gets me furthest away from what is affectionately referred to as "tag soup" :P




|| Trades - OPEN! || Request - Considering A Few... || Commissions - Not that good yet -_- ||

|| DA || ArtistsWorld ||

Offline Mister Initial Man

  • Sr. Member
  • Species: Lynx/Bear
  • ****
  • Male
  • Posts: 401
    • The Lynx's Den
HTML or XHTML
« Reply #9 on: December 15, 2005, 06:37:02 pm »
Quote (Tabuu @ Dec. 13 2005, 7:41 am)
Whatever gets me furthest away from what is affectionately referred to as "tag soup" :P


Yes, Tag soup tends to give browsers indigestion.  '<img'>

Quote (Benjamin @ Dec. 12 2005, 2:09 pm)
...simple, old school html makes the web more accessible for the less technically-inclined.


Well, simple XHTML will do much the same thing, but it's gonna be a while before XHTML, and XML in general, are widely supported.

Quote (Benjamin @ Dec. 12 2005, 2:09 pm)
HTML itself is so widespread that I can't foresee it being abandoned altogether. It would be rather foolish to eliminate it, since so many programs and sites rely on it...


I think it may be as long as 20-50 years before HTML can be considered fully deprecated.

And even then, HTML's legacy will continue.  I'm inclined to think that HTML can also be seen as a testing ground, showing what the w3c wanted in a markup language - as well as what it did NOT want in a markup language.