By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,057 Members | 1,346 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,057 IT Pros & Developers. It's quick & easy.

Testing for CSS2 support

P: n/a
Is it possible to test for CSS level 2 support, preferably using just
CSS2? For example, the following could alert the user that their
browser doesn't support CSS1 or 2. Is there an equivalent for level 2
only?

Many thanks,

Mike
<STYLE type="text/css">
DIV#no-css {
display: none;
}
</STYLE>

....

<DIV id="no-css">
<P>Your browser doesn't support cascading style sheets.</P>
</DIV>

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Michael Winter <M.******@blueyonder.co.uk.invalid> wrote in
news:Xn*******************************@193.38.113. 46:
Is it possible to test for CSS level 2 support, preferably using just
CSS2? For example, the following could alert the user that their
browser doesn't support CSS1 or 2. Is there an equivalent for level 2
only?


The problem is that no browser I'm aware of implements *all* of CSS2, at
least correctly.
Jul 20 '05 #2

P: n/a
Eric Bohlman wrote on 28 Nov 2003:

<snip>
The problem is that no browser I'm aware of implements *all* of
CSS2, at least correctly.
True, but I don't think any browsers follow the HTML specification
exactly either, but that's neither here nor there...

Hypothetically, is there a way to at least indicate if any elements
of CSS2 have been implemented, for example:

<DIV style="visibility: hidden">
<P>Your browser exhibits no support for <SPAN style="display: none"neither CSS1 nor</SPAN> CSS2. Please consider upgrading to the

latest version of your software, or to a browser with
<A href="http://www.w3.org/CSS/#browsers">CSS support</A>.</P>
</DIV>

This should show:

Your browser exhibits no support for CSS2. Please consider upgrading
to the latest version of your software, or to a browser with _CSS
support_.

....with only level 1 support, and this:

Your browser exhibits no support for neither CSS1 nor CSS2. Please
consider upgrading to the latest version of your software, or to a
browser with _CSS support_.

....with no support.

I realise that even if the above would work as intended, it doesn't
guarantee anything other than the presence of a 'visibility'
implementation. However, browser that would implement visibility,
should implement other elements, like positioning (except IE - pile
of crap), overflow, cursors, etc.

This idea would only be used on the entrance page to issue a notice
(like that one presented above) to the user that the content of the
site might not appear as it was meant to be. I'm trying to build
redundancy into my pages: CSS2 if possible, CSS1 to make it look OK,
but not ideal, if not; JavaScript to aid navigation and validation,
alternative pages if it's disabled, etc.

Maybe one day, browser developers will worry about implementing core
functionality (the various web-related specifications) first, then
worry about their own proprietory features afterwards. *sigh* and
pigs might fly...

Mike

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #3

P: n/a
Michael Winter wrote:
Is it possible to test for CSS level 2 support, preferably using just
CSS2? For example, the following could alert the user that their
browser doesn't support CSS1 or 2. Is there an equivalent for level 2
only?
<STYLE type="text/css">
DIV#no-css {
display: none;
}
You could do:
DIV[id="no-css"] { ... }

or:
BODY > #no-css { ... }

Of course, that would only test attribute or child selectors. But the
pathetic browsers are those that lack these.
</STYLE>

...

<DIV id="no-css">
<P>Your browser doesn't support cascading style sheets.</P>
</DIV>


Jul 20 '05 #4

P: n/a
Keith Bowes wrote:

or:
BODY > #no-css { ... }

Of course, that would only test attribute or child selectors.


IE/Win will parse body > #no-css as body #no-css (that is, as if it
were a descendent selector). You must remove the space, and have no
punctuation between the 2 parts:

body>div#no-css {
}

(But then, regarding the op, why do all this in the first place? I
see no reason to tell visitors that their browser choice was poorly made.)

--
Brian
follow the directions in my address to email me

Jul 20 '05 #5

P: n/a
Michael Winter wrote:

<DIV id="no-css">
<P>Your browser doesn't support cascading style sheets.</P>
</DIV>


Why do you feel the need to tell some of your visitors that they made
a bad choice of browser?

--
Brian
follow the directions in my address to email me

Jul 20 '05 #6

P: n/a

"Brian" <us*****@julietremblay.com.invalid-remove-this-part> wrote in
message news:bJLxb.246679$9E1.1319532@attbi_s52...
Michael Winter wrote:

<DIV id="no-css">
<P>Your browser doesn't support cascading style sheets.</P>
</DIV>


Why do you feel the need to tell some of your visitors that they made
a bad choice of browser?


In what way does this statement imply a value judgement?

The author is stating that this site is set up using CSS and that's why the
format might look not so nice. I see this as far more of an apologetic
explanation of why the site looks so bland than a reprimand to the user that
their choice of browser is unacceptable.
Jul 20 '05 #7

P: n/a
On Fri, 28 Nov 2003, Neal wrote:
"Brian" <us*****@julietremblay.com.invalid-remove-this-part> wrote in
message news:bJLxb.246679$9E1.1319532@attbi_s52...
Michael Winter wrote:

<DIV id="no-css">
<P>Your browser doesn't support cascading style sheets.</P>
</DIV>
Why do you feel the need to tell some of your visitors that they made
a bad choice of browser?


In what way does this statement imply a value judgement?


Value judgment or not, it goes against the long-standing advice "Don't
mention the mechanics". http://www.w3.org/Provider/Style/

If the reader knows what CSS is, they presumably know whether their
browser supports it or not, and they chose their browser for some good
reason of their own. If they don't know what CSS is, then this
message isn't going to be very informative to them anyway. So, my
"take" on this is that it's likely to annoy those who know what it
means, and serve little useful purpose to those who don't.

I suppose I'd be willing to accept a modest link, in an obscure corner
of the page, that says something like "About this web site", and links
to a separate page where the author says something about his/her
design approach: but if one does that, then it ought at least to be
worded so as to be properly informative to someone who doesn't yet
know what it's about; rather than just telling the better-informed
readers stuff that they already know and that they took into account
when they selected their browser and settings etc., while leaving the
bemused TV-web-appliance etc. users as bemused as they were before.
The author is stating that this site is set up using CSS and that's why the
format might look not so nice.


Almost all of the evidence I've met has told me that readers go to a
web page to find out the information that it contains, not to admire
its visual design. Sure, they like it to look nice too, that's not
the point; but the page itself should concentrate on its information -
the "topic of discourse" to use a technical term. Only if it's a
page about web page design should it be dealing with this kind of
detail, by and large.

CSS is designed to be optional, after all, so if the job's been done
right, there's no need to intrude into their search for information,
with off-topic comments about details of their browser.

IMHO and all that.
Jul 20 '05 #8

P: n/a
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote:
The author is stating that this site is set up using CSS and that's why the
format might look not so nice.


Almost all of the evidence I've met has told me that readers go to a
web page to find out the information that it contains, not to admire
its visual design.


Especially true for search engines. I'm not amused to read this
<http://www.google.com/search?q=cache:www.alltheweb.com>
always when I want to search via AllTheWeb.

--
But thats what FP puts in to the page, so i asume thats correct
Harry H. Arends in microsoft.public.frontpage.client
Jul 20 '05 #9

P: n/a
Alan J. Flavell wrote on 28 Nov 2003:
Value judgment or not, it goes against the long-standing advice
"Don't mention the mechanics".
http://www.w3.org/Provider/Style/

If the reader knows what CSS is, they presumably know whether
their browser supports it or not, and they chose their browser
for some good reason of their own. If they don't know what CSS
is, then this message isn't going to be very informative to them
anyway. So, my "take" on this is that it's likely to annoy
those who know what it means, and serve little useful purpose to
those who don't.

I suppose I'd be willing to accept a modest link, in an obscure
corner of the page, that says something like "About this web
site", and links to a separate page where the author says
something about his/her design approach: but if one does that,
then it ought at least to be worded so as to be properly
informative to someone who doesn't yet know what it's about;
rather than just telling the better-informed readers stuff that
they already know and that they took into account when they
selected their browser and settings etc., while leaving the
bemused TV-web-appliance etc. users as bemused as they were
before.
The author is stating that this site is set up using CSS and
that's why the format might look not so nice.


Almost all of the evidence I've met has told me that readers go
to a web page to find out the information that it contains, not
to admire its visual design. Sure, they like it to look nice
too, that's not the point; but the page itself should
concentrate on its information - the "topic of discourse" to use
a technical term. Only if it's a page about web page design
should it be dealing with this kind of detail, by and large.

CSS is designed to be optional, after all, so if the job's been
done right, there's no need to intrude into their search for
information, with off-topic comments about details of their
browser.


Those are valid points that I hadn't considered (that's why I use
Usenet). My website does display reasonably without /any/ style sheet
support, but if I were in the shoes of such a user, I'd want to know
why the page I'm viewing looks so bad.

I understand that some people disable various technologies by choice,
but they tend to do it for reasons that might not apply in every
case. JavaScript is a common example - avoided completely by a fair
proportion of Internet users. However, disabling JavaScript should
have no impact on a website, at all. Style sheets are slightly
different. They replace the presentational aspects that were removed
(deprecated) from HTML. At least with JavaScript, you might only miss
client-side, rather than server-side validation, or for external
links (that are not obviously external) to appear in a new window
rather than the current one. The site would still work as the author
intended, but the user misses somethings that might be beneficial to
them. With style sheets, the intent is lost entirely. However, I
concede that I'm going about things the wrong way, and I've removed
the notice.

Thank you all for your input. However, just to clarify: the notice in
question wasn't a judgement upon the user. It was purely
informational.

Mike

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #10

P: n/a
Michael Winter wrote:
Alan J. Flavell wrote on 28 Nov 2003:
If the reader knows what CSS is, they presumably know whether
their browser supports it or not, and they chose their browser
for some good reason of their own. If they don't know what CSS
is, then this message isn't going to be very informative to them
anyway.
Those are valid points that I hadn't considered (that's why I use
Usenet).
:)
My website does display reasonably without /any/ style sheet
support,

Then you've done a good job of authoring it.
but if I were in the shoes of such a user, I'd want to know why the
page I'm viewing looks so bad.
As suggested, this is best left to a separate page, "site info" or
some such thing, with an unobtrusive link from the main page. If your
site has a "help" section, that seems like a good place to put a more
visible link to the "about this site" page. There, you could include
a small section about the mechanics if you think it would be helpful.
But even there, I would not tell users that their browser is
backwards. Put a positive spin on it: instead of "you see this notice
because your browser does not support the standards," tell them how
their www experience might be better with a more conforming browser.
The one time I did this, I made it a point to say that the visitor's
browsing experience would likely be better on *all* sites, not just mine.
I understand that some people disable various technologies by
choice, but they tend to do it for reasons that might not apply in
every case. JavaScript is a common example - avoided completely by
a fair proportion of Internet users. However, disabling JavaScript
should have no impact on a website, at all. Style sheets are
slightly different.
I'd argue that they should be handled in the same way. They should
add presentation suggestions to the web, adding a little bonus to the
site, if you please. Without css, those little presentation bonuses
are lost, but the core of the site is the same.
with JavaScript, you might only miss client-side, rather than
server-side validation, The site would still work as the author intended, but the user
misses somethings that might be beneficial to them. With style
sheets, the intent is lost entirely.
I'd hope that that is not the case. The intent of any web site should
be the content, not its presentation.
However, just to clarify: the notice in question wasn't a judgement
upon the user. It was purely informational.


You intended it to be informational, that much is clear to me. But
try to put yourself in the user's shoes, particularly in the shoes of
someone not well versed in the mechanics of www authoring. They get
those sorts of messages all the time. My mother, for example, gets
"upgrade" messages from a game site she likes to visit when she uses
Mozilla, which I installed for her because she was tired of pop ups
advertising porn sites. Such messages just serve to confuse her.

I first saw the idea you brought up, a "your browser doesn't support
standards" message, first proposed by WASP. But after reading others
thoughts about such things here, I decided against it.

--
Brian

Jul 20 '05 #11

P: n/a
On Sun, 30 Nov 2003, Brian wrote:

[amongst much with which I agreed:]
I'd hope that that is not the case. The intent of any web site should
be the content, not its presentation.


Indeed. Of course, sometimes web pages are produced whose whole topic
is presentation. So then, "presentation" becomes the content.

But that's where I see no real alternative to offering screen shots,
because you simply cannot take the risk of discussing presentation as
the subject, if you can't rely on the presentation showing as you
intended it. Stylesheets are designed to _not_ do that, and are
therefore in general unsuitable for exhibiting browser results.

This would have to be the notorious "exception which proves the rule",
I think. Something to be looked at as a cautionary special case, but
not used as an excuse for "doing it wrong" on the vast majority of web
pages.

all the best

Jul 20 '05 #12

P: n/a
Brian wrote on 30 Nov 2003:
Michael Winter wrote:


<snip>
The site would still work as the author intended, but the user
misses somethings that might be beneficial to them. With style
sheets, the intent is lost entirely.


I'd hope that that is not the case. The intent of any web site
should be the content, not its presentation.


What I meant was, the presentation is lost entirely.

I'll try and explain what I meant better:

With JavaScript, you add extra interactive features (client-side form
validation, navigational aids, and so forth). With style sheets, you
add presentational features.

Without JavaScript, the forms (should!) be validated server-side, and
navigation will still work. Without style sheets, there is /no/
presentation, at all - only content.

That it what I meant by "lost intent" - there is no fall back when
style sheets are used for presentation, unless you use the HTML
features that CSS replaces.

The purpose of a website shouldn't be lost when it loses it's
presentation, but the author's intentions will be, because he or she
probably didn't picture it being displayed with the user's or
browser's default style sheet. I hope that now you see the
distinction I was trying to present.

Mike

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.