CSS3 REVISITED — FEATURES & BUGS
Now that Opera has joined other browsers with their implementation of CSS3 features, it becomes increasingly interesting to test and try these to see if they could become part of a standard work flow.
This post focuses on just a few issues I ran into while experimenting. Perhaps later — or in another life — I might add some positive example of the possibilities of these additions but then again there are already plenty of people doing good work in that area.
Features
I had a look at the following features:
- Multiple background images.
- Column layout module
- Text-shadow & Box-shadow
- Transitions & Transforms
1. Multiple background images
In a test I did I noticed that Firefox did not yet support this but worse: it does not degrade nicely. In my opinion it should just have used the first image listed but instead I stared at a white background with no image at all.
I have read that to have it degrade nicely you need to add an extra background rule before you list the multiple backgrounds. This seems rather bloated and unnecessary to me.
Having said that, this would however work as a work-around.
Example code
element {
background: url(fall-back-bg.gif) top left no-repeat;
}
element {
background: url(bg-one.gif) top left no-repeat,
url(bg-two.gif) top 35px no-repeat,
url(bg-three.gif) bottom left no-repeat,
url(bg-four.gif) left repeat-y;
}2. Column layout module
So far the column layout module has been implemented — to a degree — in Safari and Firefox. Opera (10.5) does not yet support it. Google Chrome (Mac) is a webkit browser but I’ve found a few differences between it and Safari.
I do think it is usable as it degrades nicely in browsers that do not support it.
As we will see in examples below for now I think this should be used sparingly because for one Safari has a weak implementation and also because I think most users will not like reading long texts on screen divided in columns that will make them have to scroll back up to read the text in the next column.
Used in separate blocks of content with mostly just paragraphs could be a nice break in the flow of an article and I think that would be a rather fair way to make use of this.
Issues with the column module layout
As said before by others the use of columns that have its text auto-flow through to the next column, does raise a few issues. Some have pointed out that currently it is not possible to keep certain elements together like having a heading attached to its paragraph.
On top of that I also do not see a way to keep a heading from flowing over multiple columns should it be long enough and starting at the end of a column.
I know there are properties called ‘break-before’ and ‘break-after’ and such but from what I understand from the W3C Candidate Recommendation of CSS Multi-column Layout Module is that these are only meant for printed media. Please feel free to correct me if I am wrong here.
Safari has some strange issues with these columns and I think these are bugs or rather a very poor implementation of the module. Below you’ll find some examples of these issues.
While writing this article I noticed another glitch in Safari and how different it acts as opposed to Firefox in regards to the multi column layout module. When I inserted the code above for the multi-background work around example, I noticed that in Safari the text is clipped on the right side, while in Firefox it is not and will act more like when overflow:visible had been set on it. I am not sure which one of these is at fault here. One could argue that because the code is inside a pre element the code should be shown ‘as is’ but does that mean the part that goes outside the defined column should be visible? Or not?
By the way: I fixed this for this post by reducing the font-size and adjusting the spaces before the text within the pre element.
Examples
Below are a few examples of the issues mentioned with the column layout module. Click an image to see a larger version.
A long header gets ripped apart.
All browsers do this the same way.
Images in strange spots.
Safari puts the image in a strange spot after setting a rotation on it.
Chrome for Mac does it even worse. The image goes outside its column box.
Weird things going on with list items
Webkit: list items with padding flow over to the next column
3. Text-shadow & Box-shadow
Text-shadow seems to work in most browsers and should degrade nicely. Heck, officially it’s a CSS2 feature. Box-shadow now works in Opera (10.5) as well.
I did notice a glitch though when a drop shadow is set on an image that has a transition applied to it. After the transition has finished — in my case it was a rotation from 5 degrees back to 0 degrees — sometimes the shadows remain in their position for a fraction of a second before being redrawn.
Box-shadow on image elements with a transform also have some issues. In all browsers when you have a transform set on an element like rotation of 5 degrees, it looks like the shadow is not being redrawn accurately.
4. Transitions & Transforms
As mentioned above there are still issues with the transition and transform features especially in combination with drop shadows or inside an element that has column-count set.
Border issues after rotation
Opera and Firefox both have issues drawing a border around an element that has a transform applied to it. In this case a 5 degree rotation. In Opera the border is just screwed up completely, in Firefox as well but to a lesser degree.
A work around for this would be to not have the border on the image element but a surrounding element instead. But then we might as well stick to adding extra elements for IE as well to create drop shadows and rounded corners, right?
Border issues with rotated images
Opera: Border around rotated image looks funny.
So now what?
Well I guess it depends on what you’re after with either of these features. Most of them are safe to use to a certain extent as long as you know if and how it degrades in older browsers.
Some of these additions to CSS could be real time savers and that will probably be a reason for a lot of people to start using it. We will probably see an even more accelerated implementation of CSS3 stuff in 2010 by all browser makers. I guess whether this is a good thing or not is for us — designers and developers to find out by keeping an eye on their implementations.
