Forum Moderators: not2easy
i have try use opacity however, the words inside the div become semi transparent as well.
so, how can i produce something like website below, where can div is semi tranparent without but the word is not.
[csszengarden.com...]
[csszengarden.com...]
Please help.
Thanx!
for my case, the bg image has plenty color, so how to make a gif that is semi-transparent(say 50%) to all color?
Pls give me a guide or tell me url that show how to do this.
Thanx!
how to make a gif that is semi-transparent(say 50%) to all color?It is impossible. The GIF format only supports bit transparency, i.e. a pixel is either transparent or a color with no in between.
As Bonusbana notes, the PNG format supports what is called alpha transparency, with 256 levels of transparency. However, Internet Explorer does not support this functionality except through hacks.
Incidentally, the CSS Zen Garden site you cited does not use partial transparency. You can see by loading [csszengarden.com...] , [csszengarden.com...] or [csszengarden.com...] individually that these files were rendered in a graphics program and exported; the layering effect is not generated by the browser.
<style type="text/css"><!-- body { width:100%; height:100%; z-index:0; background-image:url(http://www.namelesssite.com/images/logo.gif); background-repeat:no-repeat; background-position: center center; }
.cellContainer { position:relative; z-index:10; width:60%; height:200px; margin-left:20%; font-family:arial,helvetica,sans-serif; font-size:18px; }
.cellBackground { position:absolute; left:0; top:0; width:100%; height:200px; z-index:10; background-color:#c08000; -moz-opacity:.5; filter:alpha(opacity=50); }
.cellBody { position:absolute; left:10px; top:20px; width:100%; height:180px; z-index:11; }
--></style>
</head>
<body>
<h1 align="center">Layers Upon Layers</h1>
<div class="cellContainer">
<div class="cellBackground">
</div><!-- end cellBackground -->
<div class="cellBody"><p><b>I gotcher Lorem Ipsum right here, fella!</b></p>
</div><!-- end cellBody -->
</div><!-- end cellContainer -->
-moz-opacity is proprietary Mozilla-only pseudo-CSS.
filter is proprietary IE-only pseudo-CSS.
I am no standards Nazi, however. In the business world, if it works, it works... :)
though if I were I'd also advise you not to encapsulate your CSS inside comment tags (<!-- --> ) if you are using an XHTML doctype, as this will cause an XML parser to ignore your styles :)