Tricky / Impossible HTML Layouts Made Possible Through CSS

When designers with no HTML knowledge come up with unorthodox layouts, the one slicing the design gets burdened with the task of keeping the HTML version faithful to the original design without breaking the layout, often at the cost of one’s sanity. The task is sometimes complicated by other factors such as maintaining ease of updating the content (whether it be via manual entry or CMS), accessibility requirements, usability, JavaScript / AJAX, browser rendering quirks, idiotic clients, hard to please bosses, etc etc.
Many of us has shared this experience in one form or another. The beauty of the experience is that lightbulb moment where you suddenly figure it out and after 4 hours you now have a working, hand-coded, tableless CSS you can be proud of. Turns out it wasn’t so impossible, after all!
There are many ways to fix impossible CSS layouts:
- Background image trick - background images coupled with positioning tricks can be utilized to give the illusion that an element is where it’s supposed to be.
- Positioning - relative and absolute positioning when used correctly with the proper nesting can place an element almost anywhere you need it to.
- Transparent images - transparent GIF’s and PNG’s can be used to simulate layers just like in Photoshop. There is still a lot of stigma against PNG due to the lack of alpha transparency support in IE6, but this is easily fixed using IE PNG Fix, which requires very little effort and almost no modification to the HTML code.
- Z-index - the CSS z-index is a tiny gem that helps tame multi-layered CSS, ordering them the way it should be.
- Image editing - when all else fails, there is nothing easier than editing the image to make it CSS friendly. A common issue that benefits from editing are designs with non-repeatable background patterns. Usually, fading the pattern to the background color would solve this issue.
Personally, I have yet to encounter a design that cannot be encoded into HTML. I invite you all to share your experience. Got an impossible CSS design to layout? Let us take a look at it. It might not be as hard as you think.

May 14th, 2008 at 6:15 pm
Useful tips - I’ve personally been using positioning and backgrounds, though I’m a little weary of transparent PNGs (atleast until IE6 is phased out properly).
z-index is useful for very complex layouts and overlays (like those created by AJAX), but I tend to focus on minimalist and optimized themes, so z-index has not found a place in my arsenal.
May 14th, 2008 at 11:26 pm
I got this one that was funky to integrate: http://vwescape.tv/default.cfm?lang=fr&play=true
Designs are always integrable but… if you don’t want to spend too much time (cross platform debugging) and money (bandwidth), sometimes it’s better to go back to the designer and tell him what’s wrong.
May 16th, 2008 at 6:20 am
Hmmm… what about text that’s e.g. about 30° rotated. It’s impossible to style with just html/css/javascript as far as I know.
May 16th, 2008 at 5:08 pm
Nothing is impossible I think!
though the New Media Designer’s are designing more and more complexly layouts I think nothing is impossible. Im looking forward to cssis3…there are so many more posbilites …. i.e. grid - design. Very cool!
so that’s my statement
but thanks for that tips!
Greetings
June 8th, 2008 at 7:01 am
what about text that’s e.g. about 30° rotated. It’s impossible to style with just html/css/javascript as far as I know.
December 2nd, 2008 at 5:12 pm
I’ve found that in our network WAN accelerators have made a big difference