Note: No transparent image in transparent box element for IE6,7,8 FF3, Safari4

| | Comment(1) | Trackback(0)

Here is a note for no transparent image in transparent box element.


<style type="text/css">
<!--
#imageFrame { background-color: rgba(255,255,255,0.7); filter: alpha(opacity=70); }
#imageFrame img { position: relative; }
-->
</div>

<div id="imageFrame">
<img src="example.jpg" />
</div>


"background-color: rgba(255,255,255,0.7);" is for FF3.x, Safari3.x, 4.x.

"filter: alpha(opacity=70)" and "position: relative" of img tag are for IE8.

And only IE6 and IE7 need "background-color: #FFF;" after "background-color: rgba(255,255,255,0.7);", so you have to detect useragent and write css by javascript.


function uacsssw() {
 if(navigator.userAgent.match(/MSIE 6/) || navigator.userAgent.match(/MSIE 7/)){
  document.write(
   '<style type="text/css">'+
   '<!--'+
   '#imageFrame { background-color: #FFF; }'+
   '-->'+
   '</style>'
  )
 }
 if(navigator.userAgent.match(/Firefox\/2/)){
  document.write(
   '<style type="text/css">'+
   '<!--'+
   '#imageFrame { background-color: #FFF; }'+
   '-->'+
   '</style>'
  )
 }
}


You have to insert this function after style definition.

Because FireFox2 can not overwrite transparent tag of outside box element on image object, I gave it up... Please let me know if you know any trick for FF2.

notransparentimg-in-transparentbox.png

Category

, ,

Trackback(0)

Trackbacking Blog List : Note: No transparent image in transparent box element for IE6,7,8 FF3, Safari4

Trackback URL: http://mentalposition.com/mppweblog/mt-tb.cgi/403

Comment(1)

This post really makes you
think about how certain problems require that you do quite a bit of research before
finding "good data" that will answer a question in part or provide part of the solution.

Comment


Type the characters you see in the picture above.

About this blog

This page was entried by POLO March 17, 2010 12:27 AM

Previous Entry is

VMware Fusion error "lnc0: Missed packet -- no receive buffer'

Next Entry is

Add Cut & Paste to MacOSX Finder

Recent entries are in

Index Page.

Past entries are in

Archive page

RSS RSS