hii I build a page with a div that has a background and a text in it. I want to give the background a- 0.4 opacity, but without affecting the opacity of the text. for some reason, the whole div with the text and the background gets 0.4 opacity. how to I assign a- 1.0 opacity for the text?
hiii I found this answer in the web: http://robertnyman.com/2010/01/11/css-background-transparency-without-affecting-child-elements-through-rgba-and-filters/ thanx anyway
Provided youre using a selector for your element you can just assign the background of the designated element by using the following: <div id="rows"> <div class="row1"><p>Designated as "row1"</p></div> <div class="row2"><p>Designated as "row2"</p></div> </div> HTML: #rows .row1, #rows .row2 { background-color: rgba(255,255,255,0.4); } /* this will assign just the background color of ".row1", and ".row2" to be set to white, with 40% opacity, not effecting the opacity of the text at all. */ Code (markup): Resources: Hex to Rgba/Rgb converter: hex2rgba.devoth.com
.selector{ opacity:0.5; // this means %50 opacity always use number between 0.0 and 1.00 to adjust an element's opacity }