...

View Full Version : html 4.01 or xhtml



andrew1234
02-23-2005, 06:47 PM
Hi

whats better code my web pages in
html 4.01 or xhtml

and can you please tell me why?

and where is the future going?

thanks

Andrew

liorean
02-23-2005, 07:40 PM
Well, let's add another factor: media type. This is a string sent in the 'Content-Type' header from the server when you request a document. HTML uses 'text/html'. XHTML uses 'application/xhtml+xml' for plain XHTML1, and 'application/xml' for multiple namespaces XHTML. XHTML can also be sent using 'text/html' if it conforms to Appendix C of the XHTML1 specification, but then you eliminate pretty much all the benefits of going for XHTML.


Browsers will treat 'text/html' as HTML4 and 'application/xhtml+xml' as XHTML. Ie only supports the former.


If you followed through that, you should have been able to read out that if you want ie compatibility, HTML4 is the way to go.

gsnedders
02-23-2005, 08:27 PM
If you followed through that, you should have been able to read out that if you want ie compatibility, HTML4 is the way to go.You could also also use a server side script like this (http://blog.geoffers.uni.cc/archives/2005/01/07/xhtml-html/) to give XHTML to browsers that support it, and HTML to those who do not.

hemebond
02-23-2005, 09:06 PM
There's a lot more to change than just the MIME and DOC type. Especially if you have style or script blocks within the document.

liorean
02-23-2005, 09:18 PM
There's a lot more to change than just the MIME and DOC type. Especially if you have style or script blocks within the document.
And here I was trying to make him take the right decision wihtout complicating the matter...

whizard
02-23-2005, 10:02 PM
First, lets just answer his question:

It's probably better to code in XHTML, because that is the latest standard, and if you know the latest, it won't be hard to learn the next version, as well as equipping you to do more, because of better features.

The future of XHTML and Web Design is to completly separate your page content from the appearence of your page.

This way, search engines, screen readers, and small screened devices will be able to get the important content of your page, without all the styling, which is designed to look good on a desktop/laptop computer. The way this is accomplished is by semantic coding, which makes your markup meaningful.

EXAMPLE:


<div align=left>*
<h1>
NASA Field Trip
</h1>
<p>
Yesterday, the [your school here] 6<sup>th</sup> Grade class went on a field trip to the <acronym title="National Air and Space Authority Jet Propulsion Labratory">NASA JPL</acronym> testing grounds.
</p>
</div>

*I know that the align attribute is deprecated, I'm just using it to siplify a point.

The browser looks and sees:

left aligned container, holding heading one title, with a paragraph containing the acronym for NASA JPL.

A PDA, with a 150x150 screen, could detach the style sheet, and just display the text, knowing that <h1> should be bigger, blacker, and on new line. <p> could be the normal text sixe/color, and acronyms do things when you hover over them. It wouldn't care what the bg image was, or the specified colr/size of <h1> and <p>. It would just display the defaults. The layout is probably not that important to someone on a PDA, who is only trying to get the latest news.

HTH,
Dan

gsnedders
02-23-2005, 10:07 PM
And here I was trying to make him take the right decision wihtout complicating the matter...I thought you were, so I had to complicate things :)

If you want a simple answer from me, here goes:

Use HTML 4.01 Strict and CSS coded as if it was XHTML, just leaving tags like <br> open.

rmedek
02-23-2005, 10:10 PM
It's probably better to code in XHTML, because that is the latest standard, and if you know the latest, it won't be hard to learn the next version, as well as equipping you to do more, because of better features.

The future of XHTML and Web Design is to completly separate your page content from the appearence of your page.

This way, search engines, screen readers, and small screened devices will be able to get the important content of your page, without all the styling, which is designed to look good on a desktop/laptop computer. The way this is accomplished is by semantic coding, which makes your markup meaningful.

Well, remember, semantic coding isn't a requirement of xhtml. Well-formed code is. I've seen plenty of valid xhtml on this very site that is nothing more than a div for every table cell that got replaced.

At this moment, especially because of IE's lack of support for xhtml, HTML 4 is the way to go for ultimate cross-browser capability. You can still code to XHTML standards, though, so when the time comes to switch it'll be that much easier to do so.

I code all of my pages now in XHTML Strict and use PHP to send the correct headers... but it's not because it's optimal or recommended, it's because I am a big web nerd.

Also, this article has a lot of useful info on making the switch, if you choose to do so:

http://www.456bereastreet.com/archive/200501/the_perils_of_using_xhtml_properly.html


Well, let's add another factor: media type. This is a string sent in the 'Content-Type' header from the server when you request a document. HTML uses 'text/html'. XHTML uses 'application/xhtml+xml' for plain XHTML1, and 'application/xml' for multiple namespaces XHTML. XHTML can also be sent using 'text/html' if it conforms to Appendix C of the XHTML1 specification, but then you eliminate pretty much all the benefits of going for XHTML.
This doesn't complicate the matter? :D

liorean
02-23-2005, 10:43 PM
This doesn't complicate the matter? :D
It doesn't complicate it one bit, because in reality, HTML2, HTML4, XHTML1 or XHTML1.1 matters far less than 'text/html' versus 'application/xhtml+xml'. Browsers only know of one HTML superset, and that is a the total of HTML2, HTML3.2, and HTML4.01. Browsers only know one XHTML version, and that is what is bound to the XHTML1 namespace. The DOCTYPE affects parsing only to a minor degree, and only in one browser (how it affects rendering and scripting is a different story). The real choice is whether you should run it throught the error correcting HTML tag soup handler, or through the well formedness demanding XML/XHTML parser.

If you run XHTML through the HTML parser, it's no more than HTML4 with a couple of rules that only affect validation.

andrew1234
02-24-2005, 12:08 AM
ok so i read every thing and absorbed alot

but i'm still un sure.

what im getting out of what has been said is

rather code with strict html 4

is this right?

or should i start to get into the habit of making my html a little more xhtml
eg line break tag <br /> and not <br>


thanks

Andrew

rmedek
02-24-2005, 01:30 AM
At the moment I don't think there's any right way to go about it. I've read excellent arguments on either side of the XHTML/HTML fence.

Like I said, I've been coding to XHTML, but that's to satisfy the inner web-geek. Hemebond is a huge advocate of HTML 4, and he's correct that it's truly the only widely implemented code out there (as in, IE doesn't understand XHTML).

You can code to XHTML and serve as text/html to satisfy the needs of IE, but then as Liorean states, you lose all the benefits of XHTML. I'd go with what works for you.

Personally, if I was building a large business site, I'd go with HTML 4. If it was more of a personal, "stretch your coding legs" sort of site I'd try XHTML and some content-negotiation.

hemebond
02-24-2005, 01:57 AM
Hemebond is a huge advocate of HTML 4Actually, I encourage the use of what is appropriate. I do usually advocate the use of HTML over XHTML, but that's to prevent XHTML from being used or served incorrectly. For all my own development (my in-house QA system) I use pure XHTML, because I know my users can accept it and I hate Internet Explorer.

grubesteak
02-24-2005, 05:14 PM
Actually, I encourage the use of what is appropriate. I do usually advocate the use of HTML over XHTML, but that's to prevent XHTML from being used or served incorrectly. For all my own development (my in-house QA system) I use pure XHTML, because I know my users can accept it and I hate Internet Explorer.

Hemebond, is that good advice? Not trying to rag on you, but as your signature says, you "only test in Firefox?" I hate IE, don't get me wrong, but you're going to lose some of your audience if you don't make sure you get cross-browser, cross-platform compatibility.

I find that funny, since you advocate HTML over HTML? Why? Firefox is a browser that adheres (for the most part) to the ever-developing standards. XHTML is the next stage of HTML development.

Can you explain your rationale?

Every designer/developer should check out Jeffrey Zeldman's "Designing with Web Standards." It's a great book and it tells you why you should be using XHTML and CSS today. Well worth the read.

hemebond
02-24-2005, 09:20 PM
Hemebond, is that good advice? Not trying to rag on you, but as your signature says, you "only test in Firefox?" I hate IE, don't get me wrong, but you're going to lose some of your audience if you don't make sure you get cross-browser, cross-platform compatibility.That signature is in regards to code that I post on these boards. I post a standards-compliant solution to the posters problem, but that usually means it won't work in IE. It's up to the poster to add that functionality.
I find that funny, since you advocate HTML over XHTML? Why? Firefox is a browser that adheres (for the most part) to the ever-developing standards. XHTML is the next stage of HTML development.Because the majority of people don't use XHTML correctly, so it'd be better if they didn't use it at all. Plus they usually want to support IE, and you can't do that easily when using XHTML.
Every designer/developer should check out Jeffrey Zeldman's "Designing with Web Standards." It's a great book and it tells you why you should be using XHTML and CSS today. Well worth the read.Actually, while the book may state XHTML, it actually encourages the use of web standards and seperation of structure from style. HTML is just as much a standard as XHTML, and can be coded in a similar way.

ampulator00
02-25-2005, 06:34 AM
Well, if you ask me, newbies to web design should be learn or be taought HTML4 Transtional; allows some more flexibility, but much easier learning curve, if you ask me.

ronaldb66
02-25-2005, 09:49 AM
much easier learning curve I don't agree with that statement at all; why bother learning deprecated garbage, only to try to forget it moments later anyway? HTML 4.01 is fine, but as strict as possible, please.

ReadMe.txt
02-25-2005, 08:34 PM
HTML transitional allows pretty sloppy code still, either do HTML4 or XHTML1, it doesnt really matter - but make sure it's good markup and no-one will complain. XHTML1.0 is allowed to be sent as text/html but this is not recommended, so i send that mime to IE and the proper mime with a 1.1 doctype to Moz.

hemebond
02-25-2005, 09:06 PM
XHTML1.0 is allowed to be sent as text/html but this is not recommendedIt's not recommended because as soon as a compliant parser looks at it, it'll see garbage, and output garbage. I hate that entire backwards-compatibility section of the spec.

If the browser doesn't support XHTML, don't send it XHTML. I'm sorry, but it annoys me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum