Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





  Last Thread  Next Thread
Author
Thread Post New Thread   

How can I give an element a semi-transparent background?
 

Trond Michelsen




quote this post edit post

IP Loged report this post

Old Post  08-23-06 - 11:58 PM  
Hi.

I have a transparent PNG-image that I would like to display on top of
the rest of the web page. I've already got this part working. But, I'd
like the background (as in "the part of the image that is transparent"),
to be semi transparent instead. So, I've wrapped the image in a
div-tag  with the style "opacity: .70" instead. This gives me pretty
much the semi transparency that I'm looking for, except that this makes
the entire image transparent as well. I tried setting the opacity of the
image to 1.0, but that didn't make any difference.

As a workaround, I've taken the image out of the div-tag, and positioned
them on top of each other. This "works", but it really doesn't "feel"
right. It's a clumsy solution, and I was hoping there's a better way to
do this.

So, is it possible to set the opacity of an element without affecting
the opacity of the element's children?

--
Trond Michelsen


Post Follow-Up to this message ]
Re: How can I give an element a semi-transparent background?
 

VidTheKid




quote this post edit post

IP Loged report this post

Old Post  08-26-06 - 11:33 PM  
Trond Michelsen wrote:
> I have a transparent PNG-image that I would like to display on top of
> the rest of the web page. I've already got this part working. But, I'd
> like the background (as in "the part of the image that is transparent"),
>   to be semi transparent instead.

Why not alter the PNG to have a semi-transparent background, instead of
fully transparent?  At the risk of answering my own question, IE 6 or
eariler would make such a PNG entirely opaque.  But that may be the
case already, depending on which transparency style your PNG uses.
8-bit PNGs have essentially the same capabilities as GIFs, except
without animation.  There is a 256 color limit, with "transparent"
counting as a color.  IE 6 displays these correctly.  There are also
32-bit PNGs, where each pixel can be any color at any opacity.  IE 6
renders these incorrectly, and the result is essentially the intended
image plastered onto a solid gray rectangle.  IE 7 promises to display
these images correctly.

I'd be glad to alter your PNG for you if you don't mind alienating IE 6
users.

--
Vid the Kid



Post Follow-Up to this message ]
Re: How can I give an element a semi-transparent background?
 

Trond Michelsen




quote this post edit post

IP Loged report this post

Old Post  08-26-06 - 11:33 PM  
VidTheKid wrote:
> Trond Michelsen wrote: 
> Why not alter the PNG to have a semi-transparent background, instead of
> fully transparent?

Well, the PNG is generated on the fly from a program called mapserver,
and although it's possible to get mapserver to generate 32-bit PNGs,
there's no opacity setting, only transparency on/off.

> At the risk of answering my own question, IE 6 or
> eariler would make such a PNG entirely opaque.  But that may be the
> case already, depending on which transparency style your PNG uses.

Right. It's opaque in IE6 at the moment, but I don't worry too much
about that right now. I'll deal with IE later.

> I'd be glad to alter your PNG for you if you don't mind alienating IE 6
> users.

I'd gladly let you fix them, if it had been a finite number of PNGs :)

I guess I could do som trickery on the webserver to send the images
through ImageMagick, and fix the transparency here, but if there's a CSS
solution, I'd rather use that.

--
Trond Michelsen


Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 05:38 PM. Post New Thread   
  Previous Last Thread   Next Thread next
Stylesheets archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top