/    Sign up×
Community /Pin to ProfileBookmark

Check for CSS capabilities

Some browsers (<IE6) have no support for the :hover tag, as you are well aware. I need a quick way to check for browsers that do not have this support, so that I can conditionally include some CSS rules to change how my site behaves. I don’t want to use JavaScript, since it sucks, so that’s why I’ve posted here. Any solutions? Thank you!

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 07.2007 — By far the best solution is to design your [X]HTML/CSS to be logically and semantically marked up so that the page degrades "nicely" when various visual display attributes are not supported by the client. (For instance, for an extreme case, what happens if someone views the page with a plain-text-only browser?)

While a PHP script could make an educated guess at the client type by parsing the $_SERVER['HTTP_USER_AGENT'] value, that header is not required to be sent by the client nor is it in any way guaranteed to contain the correct value.

If all you are worried about is customizing your output for particular versions of IE, I would suggest using [url=http://www.quirksmode.org/css/condcom.html]IE conditional comments[/url] in your markup.
Copy linkTweet thisAlerts:
@bokehNov 07.2007 — I agree with Nogdog (except that at the present time I would stick to HTML 4.01 strict and not go near XHTML until all modern majority browsers support it; IE doesn't and serving a content type to a client that is not explicitly mentioned in the accept header is wrong).

I don't want to use JavaScript, since it sucks[/QUOTE]Javascript is the tool recommended by W3C for website behaviour.
×

Success!

Help @jwilliams spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...