-
200721 Aug
Posted in CSS3 Previews, Declarations
I was reading Veerle’s blog today; the excellent article A CSS styled table version 2, to be precise. All good, practical stuff, and well-presented as usual. But what stood out for me was the technique to stripe the table rows: either through classes, or Javascript.
Of course, both of those are valid techniques; but really, neither should be. It’s pretty easy to forget, when we see how far CSS-based design has come in the last few years, just how reliant on workarounds and tricks we are in order to perform what should be basic functions.
Presented below are some of those workarounds that I’d love to see consigned to the dustbin of history; not because they are bad – on the contrary, they are extremely inventive – but because CSS 3 should allow the effects to be replicated without the extra mark-up, script or code.
Tiger-striping on table rows
Whether done with background images, DOM scripting or just adding classes to the markup, none of the techniques are as easy as using the
nth-child
pseudo-class:tr:nth-child(odd) { color: blue; }
‘Sliding Doors’
Requires no extra mark-up but a lot of CSS jiggery-pokery, most of which could be avoided with multiple background images:
li { background: url('image0.png') no-repeat left top, url('image1.png') no-repeat right top; }
Rounded corners
Which do you prefer: multiple lines of Javascript? Or a single line of CSS?
div { border-radius: 1.5em; }
Drop shadows
Even the simplest solutions seem to rely on an extra image and plenty of CSS tweaks. CSS 3 resolves it with one declaration:
img { box-shadow: 10px 10px 5px; }
Of course, the problem is that perennial one: lack of support. No modern browser currently supports all of the examples shown above, and it will be many years before we can stop using the workarounds altogether. But I do look forward to the time when they become a secondary consideration – and to what extensive use of the new declarations reveals in terms of creating new workarounds to future problems.
You can skip to the end and leave a response.
-
Comments
-
01.
As far as rounded corners go, I find the rendering to be not smooth enough, so even if it was supported by all browsers, I’d probably still prefer to use images in most cases.
-
02.
Jim says:Comment » August 21st, 2007 at 4:56 am
I believe the aliasing for rounded corners is a Gecko bug that’s going away with the move to Cairo, which will be in effect for Firefox 3.
Check it out:
http://www.actsofvolition.com/archives/2006/december/cairocornersin
Aliasing is not inherent in CSS rounded corners, I hate that a Gecko bug gave this technique a bad reputation.
-
03.
Soluciones CSS3 para…….
… tablas cebreadas, "Sliding Doors", esquinas redondeadas y sombras…….
-
04.
Yeah, Tiger Striping and multiple background images, I’m waiting for that so long.
Hehe, yesterday I read my Professional CSS book ( again =] ) and the content of that chapter is almost the same as the article here. -
05.
I’d be most interested in finding out if there is a watchlist keeping tabs on the various browser companies to see when/how they plan on implementing various CSS3 features. I know they say “A Watched Pot Doesn’t Boil” but I’m very keen on watching…
-
06.
I believe the aliasing for rounded corners is a Gecko bug that’s going away with the move to Cairo, which will be in effect for Firefox 3.
Yeah, I’ve tested some Firefox 3 builds, and it looks much nicer. The Safari 3 beta also renders them quite nicely.
-
07.
jackalwackal says:Comment » August 21st, 2007 at 7:06 pm
I just hope they completely implement CSS 2.1 first. I think Safari and Konqueror has that, plus up-to-date on most CSS 3 stuff.
-
08.
Fatih Hayrioğlu’nun not defteri » 21 Ağustos 2007 Web’den Seçme Haberler says:Comment » August 21st, 2007 at 10:50 pm
[…] Beklemek zorunda olduğumuz bir kaç CSS özelliği. Link […]
-
09.
In Firefox 3, is/are background image(s) round-clipped when using border-radius?
This is the third most annoying “bug” in border-radius implementation. Or isn’t the background image clipping requiered by the standard?
The second bug in Firefox 2, is that if you specify -moz-border-radius: 4px; all corners do not look the same! I hope Firefox 3 also solve this issue.
-
10.
@Sébastien
Looks like it will be fixed it in time or maybe its already fixed?
https://bugzilla.mozilla.org/show_bug.cgi?id=24998#c23 -
11.
Likewise, I can’t wait to be rid of these methods. The table striping method in particular. Conincidently I mentioed the same thing on Veerle’s blog a few hours ago; as well as another method – using XSLT.
-
12.
[…] CSS techniques I can’t wait to be rid of […]
-
01.