Smuggling Proprietary CSS: How To
Posted @ 2006:02:07:01:45 in CSS.Have you ever been tempted to use a CSS property such as -moz-border-radius, but can’t stand the thought of having a page that refuses to validate?
No… Me neither…
<.<
>.>
But just suppose…
The Problem: You can’t include the css in a style tag, and you can’t link it with a link tag, so what can you do?
The Solution: Stick it in a style attribute. The W3 validator doesn’t check the style attributes of tags, so you can smuggle the naughty CSS into your pages that way. Don’t believe me?
The Test: The section below is encapsulated within a div whose style attribute makes use of -moz-border-radius for rounded edges.
Click the links to check the validity of this page.
The Conclusion: Look, we’re talking about literally smuggling the bad CSS into pages here. This isn’t a hack so much as it is an observation. You aren’t doing anything special, you are just putting the bad CSS in the one place they’d never look. Yeah, it is kind of an ugly method, but you shouldn’t care since if you’re going to use it, right? After all, depending on proprietary CSS is like depending on a rotten wood catwalk over a tank full of the proverbial kind of bovine fecal matter. And let’s be honest… If you’re so anal-retentive that you want both vendor markup and the shiny badge of valid css… Why don’t you just clear your conscience and forget the vendor’s special goods anyway? Still. It’s a neat lil trick, huh?
I never validate anyways. Bah.
Smuggling Proprietary CSS and the Validity of the Validator
Will makes an interesting point in his blog post about using browser-specific CSS and still having webpages validate. His quandry:
Have you ever been tempted to use a CSS property such as -moz-border-radius, but can’t stand the thought of having a …
Well, W3C validation a site does not make.
Just a dirty little trick to sneak bad stuff past the validator, kind of like IE’s conditional comments.
Please reword your last statement.
“Well, W3C validation a site does not make.”
NO.
I like my awkward wording.
Awkward, your wording, I too, like.
Thanks for the evil tip.