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?
| SitePoint Sponsor |
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?
DarkStation - No-nonsense Console Gaming Coverage.


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![]()
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more




I don't see anywhere in xhtml where it states you have to use as few tables as possible.This means full use of CSS for layout of your page and as few tables as possible
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


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.![]()
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more


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.


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.
};-) http://www.xhtmlcoder.com/
Thinking Web: Voices of the Community
> March 2013 - SitePoint forums: Spot the Error 3: Calling all Sleuths! Winner Announced!... She knows how to spot simple <code> errors but do you?


Woot, our thread made it into the Tech Times![]()
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
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)



I'm not having too much trouble making the change. I was already in the habit of closing tags to begin with. When I started learning, I closed all tags possible, it was too confusing to try and remember which ones you had to close and which ones you didn't. It does feel good because your code is nice and neat. I have however been very lazy about changing some old code.Originally Posted by AlexW
Alone we can do so little; together we can do so much.
-----------------------------------------------------
tinyplanet.org <--a nifty spot.
<br /> still has valid uses however. Try creating a layout that makes extensive use of floats; you'll find that you need a <br clear="all" /> in there at least once.Originally Posted by AlexW
Originally Posted by AlexW
Yes it's a "dirty" tag to me, even in XHTML. I use it only when necessary
.


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.
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more


Don't know what either do![]()
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more





<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.
I'm in the middle of re-coding everything to validate to XHTML 1.0 standards. It was hard remembering closing those tags, making sure everything was properly nested but I feel much better now.Originally Posted by AlexW
![]()
Last edited by Rizal; Jul 24, 2003 at 02:39.
DarkStation - No-nonsense Console Gaming Coverage.





Why bother doing a CSS layout if you are going to keep on using Transitional HTML?Originally Posted by vgarcia
Douglas
Hello World
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?
DarkStation - No-nonsense Console Gaming Coverage.





Are you looking for resources?Originally Posted by Rizal





No browser (that I know of) supports XHTML as XML, but most are quite happy to treat it as HTML 4.01Originally Posted by Rizal
(If you follow these guides)
Douglas
Hello World


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.
};-) http://www.xhtmlcoder.com/
Thinking Web: Voices of the Community
> March 2013 - SitePoint forums: Spot the Error 3: Calling all Sleuths! Winner Announced!... She knows how to spot simple <code> errors but do you?
if i remember correctly, an xhtml strict document sent as application/xhtml+xml to Opera7 is treated as xml...so much so that if there is an error in its syntax, it shows a big fat error message right where the syntax error occurred (and not some quirks mode stuff)Originally Posted by DougBTX
re·dux (adj.): brought back; returned. used postpositively
[latin : re-, re- + dux, leader; see duke.]
WaSP Accessibility Task Force Member
splintered.co.uk | photographia.co.uk | redux.deviantart.com
Mozilla likes XML content just fineOriginally Posted by DougBTX
<meta http-equiv="Content-Type" content="text/xml; charset=UTF-8" />





I stand correctedOriginally Posted by redux
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:
With a correct end tag, all render the sameCode:<?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 itatleast when loaded off your harddrive...
Hello World
Bookmarks