Thursday, May 26, 2011

CSS Opacity

Who said that CSS Opacity was nice? It is until you have to overlay another div tag outside the one with the opacity style to get the overlaying elements with no transparency. What a waste of coding to have so many div tags! Adding so many div tags not only increases your file size, but also makes coding even more confusing.

I use Dreamweaver to help organize the div tags, but the numerous indentations from the Source Formatting can be hard to get through. Besides, all those spaces/tabs inserted for the source formatting makes for a larger file size (slower page load).

I am strict about file size because the more space I save, the more code and nicer page I can develop.

CSS: overflow:visible Doesn't Always Work IE8 and maybe less than IE8

As most of you reading this know, browsers are pretty picky about how they display style sheets. I just found out, through trial and error, that there was a conflict with styles that was disrupting my layout.

I wanted to have an image within a div tag. The image was to extend beyond the div and be visible. (This was for AJAX reasons).

The encompassing div tag had a translucent background, shadow and curved corners.

This was working on FF4 and IE9. But IE8 cut off the image that extended beyond the div, even with "overflow:visible !important;"

The conflicting style was "filter:alpha(opacity=85);". So I had to remove that from the main CSS and put it in one of those stupid tags specifically for IE8 and less.

<!--
[if gt IE 8]>
<style>
.featured {filter:alpha(opacity=85) !important;}
</style>
<![endif]

[if !IE]>
<style>
.featured {filter:alpha(opacity=85) !important;}
</style>
<![endif]
-->


Why can't everybody play nice together? Isn't that what W3C is for?