2005
Transparent Element using CSS
Sponsored Links
Let’s play with Mozilla’s CSS again. Now we’ll try to make a cool transparent element with -moz-opacity property. This property is also available in CSS3 specification with the name opacity. Using this property, you can control how solid your element is. The value is ranged from 0 (full-transparent) to 1 (solid). So, 0.5 value means the element is 50% transparent.
Watch the sample below:
All of the 4 boxes actually have the same color, red. What make each looks different is the -moz-opacity setting. Box #1 has 25% opacity (0.25), box #2 has 50% opacity (0.5), box #3 has 75% opacity (0.75), and the last box #4 has 100% opacity (1).
Here’s the code:
[css].bigBox {
background-color: black;
width: 100px;
height: 100px;
border: 1px solid #000;
margin: 0 5px 10px 0;
padding: 0;
float: left;
display: block;
}
.box1, .box2, .box3, .box4 {
background-color: red;
width: 50px;
height: 50px;
border: 0;
margin: 0;
padding: 0;
float: left;
text-align: center;
color: white;
}
.box1 {
-moz-opacity: 0.25;
opacity: 0.25;
}
.box2 {
-moz-opacity: 0.5;
opacity: 0.5;
}
.box3 {
-moz-opacity: 0.75;
opacity: 0.75;
}
.box4 {
-moz-opacity: 1;
opacity: 1;
}[/css]
[html]
[/html]
Try to combine this with element who has background image and you’ll surely get a nice effect. Hover will look good too. I already implement this in my comment list element. If you want to see it, just find any post in my blog that has lot of comments, and check out the comment box
)
Good luck :d
Transparent Element using CSS is written by cosa and posted under Web & Graphic Design , css, design, mozilla. If you like it, you might consider subscribing to our feed, follows us on Twitter, or receive our latest posts via email. Or else, you could also or store it to your favourite social bookmark sites. Further information about this article can be found.
And while you're here, why don't you check out our other articles:
Pssst! Most people are coming to this page searching for: css transparent,css transparent box,transparent css,css transparent firefox,firefox css transparency,transparent in css,css transparency firefox,css trasparent,opacity,firefox opacity CSS,firefox transparency css,firefox css opacity,transparent box css,opacity css firefox,transparency css,firefox css transparent,transparent comment box,css firefox transparent,firefox transparent css,transparent css firefox, 


Here is solution for IE browser.
filter:alpha(opacity=40);