html - specificity issue w/ CSS opacities: overriding the opacity of the parent div -
i have div (id=alertpanel) want put in front of div (id=captchapanel). captchapanel div has opacity of .25 -- want front alert div tp 100% opaque. (i going lightbox-like effect). both divs have ids , not in classes. assign div opacity of .25 , front div opacity of 1 -- front div still not opaque (in chrome , safari @ least... in ff , ie). making id-specific rule in simple application of css, confused why getting result.
here html:
<div id='captchapanel'> <div id='alertpanel'> in middle </div> //some html </div>
here css:
#alertpanel { height: 10%; width: 10%; margin-left: auto ; z-index:1; margin-right: auto ; position: absolute; background-color:blue; float:none; opacity:1 !important; } #captchapanel { height: 60%; width: 57%; background-color:#580200; vertical-align:middle; margin-left: auto ; margin-right: auto ; border-radius:15px; opacity:.05; z-index:-1; }
a child inherit opacity of parent.
if using colors, change #captchapanel use rgba:
background-color: rgba(0,0,0,.05);
you change markup alertpanelis not descendant of
captchapanel`
<div class="wrapper"> <div id='captchapanel'>//some html</div> <div id='alertpanel'>in middle</div> </div>
Comments
Post a Comment