Alternative coding for opacity. Web development.

TubaRiver

Masterful
Donor
Joined
Aug 6, 2011
Messages
278
Reaction score
317
As the title says I'm looking for an alternative method for opacity via CSS.

Here's what i mean by that.
Code:
#DivA{
position:absolute;
top:250px;
right:10px;
width:25%;
height:100%;
background-color: black;
border-spacing: 2px;
border-style: solid;
border-color: red;
filter:alpha(opacity=40);
opacity:0.4;
}
 
#DivB{
float:right;
margin-top:5px;
margin-right:10px;
margin-bottom:5px;
font-size: 20px;
color: white;
}
 
<div id="DivA">
<div id="DivB"> Random Text </div>
</div>
The code provided, allows for transparency for DivA (which is what i want) HOWEVER! DivB is being placed inside of DivA. For some reason, it's obtaining the transparency, along with its text. That is what i do not want.

Further research indicates one method is to "trick" the site, with the code and placement. (ergo abso, position with exact cords) It works, but i don't want to constantly use abso position, especially with child elements. Is there any way i can float the DivB. while keeping it opaque, and keeping the DivA transparent?

Similar to how these forums are set. The white is transparent, yet the child elements ontop, are not, nor positioned absolute, AND remain opaque. I can't really find where it gives the needed code within the forum's view:source. (it's all cluttered and messy :I ) Any help?
 
Joined
Aug 6, 2011
Messages
983
Reaction score
966
It looks like you are in luck today! I've been in exactly the same scenario as you, and I found a nifty little work-around (that only works for single colour transparencies AFAIK)

I present to you the RGBA:
http://www.css3.info/preview/rgba/

(There's an extra parameter that states the alpha value, and doesn't make other elements become transparent!)
 

TubaRiver

Masterful
Donor
Joined
Aug 6, 2011
Messages
278
Reaction score
317
It looks like you are in luck today! I've been in exactly the same scenario as you, and I found a nifty little work-around (that only works for single colour transparencies AFAIK)

I present to you the RGBA:
http://www.css3.info/preview/rgba/

(There's an extra parameter that states the alpha value, and doesn't make other elements become transparent!)
Que Magnifico!

No child inheritance! This is perfect! but.... i never use RGB/A codes for the colors. (Those are like.... cmd color codes D: ) I'm good with hexidecimal....or just standard names :D haha bah. Time to learn new codes. x)

Gracias UltimateBudgie
 
Top