|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Enthusiast
![]() Join Date: Aug 1999
Location: Kuala Lumpur, Malaysia
Posts: 68
|
HTML 4.0 or XHTML 1.0?
I'm not sure whether this has been asked before, but here goes.
To ensure current and future compatibility, which one should I use, and why? |
|
|
|
|
|
#2 |
|
Follow Me On Twitter: @djg
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2000
Location: Philadephia, PA
Posts: 19,728
|
If coded PROPERLY, both of them will be compatible for many years to come. None of the browser makers have any intention of dropping HTML4 support any time in the foreseeable future.
If you're going the XHTML route, remember that you're going to need to separate your structure from your design as completely as possible. This means full use of CSS for layout of your page and as few tables as possible. XHTML is both backwards and forwards compatible -- it'll render on current and past browsers, but you're not going to have the same presentation on 4x generation and older (to most people, this means Netscape 4.x) browsers. They'll get the content, but likely not the design. The advantage to XHTML is easier updating, and if validly written, compatibility with most current and future browsers, phones, PDAs, and accessibility such as screen readers. Writing valid XHTML will also make it much reader to reach those accessibility guidelines becoming law in many countries. Another huge advantage is in bandwidth -- the average XHTML1.0/CSS page (like SitePoint's site, specifically outside of the forums) is much lighter than an HTML4 page because all you get is the content, not the formatting. The stylesheet only has to be downloaded once. Speaking of that, don't forget you can change the entire look and feel of your site, the entire design, just by editing your stylesheets. If you need it to look pixel perfect in older browsers without the CSS support a true XHTML/CSS page requires, go with HTML 4. Like I said above, you still need to code it properly, and browsers won't stop supporting this in the future as long as you make proper use of the DOCTYPE tag. You can figure out the drawbacks by reading the advantages of XHTML. If you're interested in the XHTML/CSS route and want some extra help, I recommend the book "Designing with Web Standards" (much over SP's book). Good luck ![]() |
|
|
|
|
|
#3 | |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Dec 2002
Location: Switzerland
Posts: 745
|
Quote:
xhtml just means "clean code" and "xml compatible", and while the philosophy behind it is that it provides a better environment for CSS prevalence over tables it doesn't mean you have to do it. You can also style tables with CSS very easily, and in some (many ?) cases that will do a cleaner and smaller html (which are the two main arguments for CSS-P) than if using CSS. just my 2 cents Quentin |
|
|
|
|
|
|
#4 |
|
Follow Me On Twitter: @djg
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2000
Location: Philadephia, PA
Posts: 19,728
|
XHTML doesn't state anything about how you should go about using it -- you can wrap your site in a million tables and make each page a megabyte in size.
It's just the philosophy that goes along with transitioning towards XML. If you don't want to try to adopt that philosophy, stick to HTML 4? This is just my advice as well, but I see no reason to use XHTML if you're not going to make the full changeover from the old way of thinking about web page design. Another 2 cents from me. You're getting rich, Rizal. ![]() |
|
|
|
|
|
#5 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: May 2003
Location: Liverpool
Posts: 361
|
XHTML is an extension of the HTML 4.01 standard, bringing XML functionality into it. By using xhtml over html 4.01 you will be opening your site up to a number of UAs that can't access html as well as a browser can, and also providing the capacity for your markup to interact with programming and scripting languages in a more logical way.
|
|
|
|
|
|
#6 |
|
Robert Wellock
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Apr 2002
Location: A Maze of Twisty Little Passages
Posts: 1,862
|
eXtensible HyperText Markup Language (XHTML) is well-formed eXtensible Markup Language (XML) that has been written to mimic HTML 4.01.
Thus for future proofing the XHTML Family has the edge and potentially a wider user-agent, platform base and greater interoperability as was mentioned before. |
|
|
|
|
|
#7 |
|
Follow Me On Twitter: @djg
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2000
Location: Philadephia, PA
Posts: 19,728
|
Woot, our thread made it into the Tech Times
![]() |
|
|
|
|
|
#8 |
|
Team SitePoint
![]() Join Date: Apr 2000
Location: Melbourne
Posts: 1,007
|
I think XHTML is a good habit to get into. It takes little time to learn the differences and is more accessible for non-browser devices. Anyway it feels good
![]() After a while I couldn't bring myself to write HTML anymore. I kinda feel dirty even seeing a <br> in my old code, let alone writing one... hehehe . Have to spin a find and replace through the code before I can touch it. And unclosed list items?!?! (involuntary shiver) |
|
|
|
|
|
#9 | |
|
because you gotta have beer!
![]() ![]() ![]() ![]() Join Date: Apr 2000
Location: Roxbury/Boston
Posts: 484
|
Quote:
|
|
|
|
|
|
|
#10 | |
|
☆★☆★
![]() Join Date: Jan 2002
Location: in transition
Posts: 21,481
|
Quote:
|
|
|
|
|
|
|
#11 |
|
Team SitePoint
![]() Join Date: Apr 2000
Location: Melbourne
Posts: 1,007
|
Oh I have nothing against '<br />'. Use it all the time.. ... just the non self-closing version '<br>' makes me feel the need to wash.
|
|
|
|
|
|
#12 | |
|
☆★☆★
![]() Join Date: Jan 2002
Location: in transition
Posts: 21,481
|
Quote:
Yes it's a "dirty" tag to me, even in XHTML. I use it only when necessary . |
|
|
|
|
|
|
#13 |
|
Follow Me On Twitter: @djg
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2000
Location: Philadephia, PA
Posts: 19,728
|
What does <br clear="all" /> do?
I'm only 3/4 through "Designing with Web Standards" and haven't started "Eric Meyers on CSS" yet. |
|
|
|
|
|
#14 |
|
Team SitePoint
![]() Join Date: Apr 2000
Location: Melbourne
Posts: 1,007
|
Doesn't <br style="clear:both"> work pretty much the same as "<br clear="all" />" ?
(I wouldn't normally do it inline like that) |
|
|
|
|
|
#15 |
|
Follow Me On Twitter: @djg
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2000
Location: Philadephia, PA
Posts: 19,728
|
Don't know what either do
![]() |
|
|
|
|
|
#16 |
|
Organic SEO Expert
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2003
Location: European Union
Posts: 1,577
|
<br clear=all or left or right or none> breaks the text flow and resumes the next line after the specified margin is clear. This is often used to start the text below an aligned image (preventing text wrap). "none" is the default, causing a simple line break.
|
|
|
|
|
|
#17 | |
|
SitePoint Enthusiast
![]() Join Date: Aug 1999
Location: Kuala Lumpur, Malaysia
Posts: 68
|
Quote:
![]() Last edited by Rizal; Jul 24, 2003 at 03:39. |
|
|
|
|
|
|
#18 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Bath, UK
Posts: 2,532
|
Quote:
Douglas |
|
|
|
|
|
|
#19 |
|
SitePoint Enthusiast
![]() Join Date: Aug 1999
Location: Kuala Lumpur, Malaysia
Posts: 68
|
I'm already sold on XHTML 1.0. Now I need to compile a list of browsers (and their versions) that support (fully/partial) this standard. Any ideas?
|
|
|
|
|
|
#20 | |
|
Organic SEO Expert
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2003
Location: European Union
Posts: 1,577
|
Quote:
|
|
|
|
|
|
|
#21 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Bath, UK
Posts: 2,532
|
Quote:
(If you follow these guides)Douglas |
|
|
|
|
|
|
#22 |
|
Robert Wellock
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Apr 2002
Location: A Maze of Twisty Little Passages
Posts: 1,862
|
Well just remember within HTML 4.01 the start and end tags for the HTML, HEAD and BODY elements are optional, but specifying the Document Type Definition, the character encoding and the TITLE is a requirement.
That was one of the main reasons I never really liked HTML 4.01. |
|
|
|
|
|
#23 | |
|
gingham dress, army boots...
![]() Join Date: Apr 2002
Location: Salford / Manchester / UK
Posts: 4,856
|
Quote:
|
|
|
|
|
|
|
#24 | |
|
Web-coding NINJA!
![]() Join Date: Jul 2002
Location: Dallas, TX
Posts: 2,910
|
Quote:
<meta http-equiv="Content-Type" content="text/xml; charset=UTF-8" /> |
|
|
|
|
|
|
#25 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Bath, UK
Posts: 2,532
|
Quote:
![]() IE6, Moz and Opera all throw nice big errors with invalid XML sent as XML, very cool. (That means that... I can use XHTML 2... today?) There is hope yet ![]() Douglas
Edit: In each case, I sent this as application/xml along with a style sheet: Code:
<?xml-stylesheet href="xml.css" type="text/css"?> <mytag> <my>hi</my> <my>hii</my> <my>hi</my> </mytaggggggg> ![]() I wonder what IE5/IE5.5 do with it... Douglas
Edit: Works 100% in IE5.5 by the looks of it atleast when loaded off your harddrive...
|
|
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 01:44.














Yes it's a "dirty" tag to me, even in XHTML. I use it only when necessary 



Linear Mode
