lucy24 - 9:44 pm on May 11, 2011 (gmt 0)
This is where those user-agent-spoofers come in handy if you forgot to hide copies of your older browsers so they wouldn't get overwritten when you upgrade. Do as I say. Not as I do.
What follows comes from rules learned while making e-texts, where one of the criteria is that it has to be readable even without CSS, and scripting is strictly forbidden, but it's adaptable to HTML in general.
In CSS you can generally make something cumulative. For each feature, start with setting up something that works in both 2 and 3, and then add the bits that will only be done if the browser recognizes 3. This is assuming for the sake of discussion that you're dealing with "compliant user agents", meaning that they ignore anything they don't understand. (In the case of That Browser, this is not always a safe assumption. What a good thing the "conditional comment" is only recognized by ... the only browser that ever requires a CC ;))
The nasty thing about html5 is that they've dispensed with the dtd (what's supposed to happen when they develop html6?) so when the browser sees a naked "html" they'll interpret it as whatever the ### they feel like-- and once they've picked a language, they're not going to change halfway through the text. Probably. So you have to deal with both possibilities:
#1 Things that work in HTML4 but aren't recognized in HTML5. Luckily most of them are things like <font> that you shouldn't be using anyway. But some things like the loss of <tt> really are an annoyance. (They only decided at the eleventh hour to keep "target = _blank". Whew.) Time to get verbose and shovel things into the CSS.
#2 Things that are new to HTML5. Same deal as CSS: the page has to work without them, unless you serve different versions depending on exactly what browser you're dealing with. Well, you probably do already. But normally just for browser names, not version numbers. And cross your fingers when dealing with users who've disabled everything that would allow you to find out what browser they've got. Now you've got an infinitely growing set of variant forms because some people never, ever update their browsers while others do it religiously-- and sometimes you really need to keep those older-browser users.
Aside: Old software doesn't always equate to customers without money. If, say, you're selling antique furniture or a certain type of real estate, you've got customers who reluctantly bought a computer in 2003 but have flatly refused to change anything about it since then. And if they're living on a trillion-acre estate they may be on satellite, which can be just as slow as dialup. You don't want to lose them.
Oh, and #3 The icky, messy area of things that are interpreted differently between HTML4 and HTML5. Better leave 'em out altogether, unless your page actually is written in 4 and says so.