Forum Moderators: mack
Andrea
<!--[if lte IE 5]>
<p>Upgrade your browser!</p>
<![endif]-->
that basically says that any browser prior to IE5 will print out the paragraph, but all other browsers will regard it as a comment.
the other way that people normally do it is to write something like this
<p class="hide">Upgrade your browser!</p>
and put
.hide{display:none}
in a stylesheet.
but instead of linking to the stylesheet in the head, they will import it instead, using @import
early browsers don't recognise import, so they will not know to hide the paragraph.
Our humane society is replacing its current site with a css-based site that won't work with older browsers.
Why?
One of the primary ADVANTAGES of CSS is that (if properly constructed) the site will degrade gracefully for older browsers.
Actually, the biggest compatibility problem with CSS is with browsers that A LITTLE old. i.e. those that support CSS, but support an older version than you are using. You may need to provide multiple style sheets for different browsers.
Alternately, you can provide NO style sheet for older browsers that don't support your version of CSS, if you can not justify the time and expense of creating alternate stylesheets.
For a really old browser, though, that doesn't support CSS at all, insuring compatibility is a matter making sure your text appears in the correct order (don't put the last paragraph first and then reposition it with CSS!), and few other simple rules, along with checking in an old browser (or with CSS rendering turned off) to make sure that it makes sense.
Aside: It doesn't help that many of these IE-only sites want me to "upgrade" to a version of IE that is older than the (more advanced and compliant) browser that I'm already using....
Eliz.
If you tell somebody their browser isn't good enough for your site, you might as well be telling them that their mother is ugly and walks funny.
I realize this (probably) isn't the case with the poster's site, but insisting on a particular brand of browser (typically MSIE) gets the strongest reaction.
I'd guess the next-worst thing you can do is to claim that the user needs a browser "ugrade", when, in fact, they have a newer browser than your site is written for.
There are better ways of handling this than telling the user that their browser isn't up to snuff.
First, try to write your CSS to accommodate the last couple of versions of the most popular browsers. If you are using something extra-special that you really cannot part with, you can detect the browser and serve modified or different style sheets for different browsers.
For older browsers, you can still supply your content in a readable form by serving NO style sheet (for browsers that support style sheets, but just not the version of CSS you are writing to.) There's a bonus to this - if your site is readable, makes sense, and can be navigated with just basic HTML and no style sheet, it will also be reasonably accessible to non-sighted viewers.
You're already detecting the browser, in order to serve the "go away, you're not wanted here" message. Why not just use the same information to omit the style sheet?