There is a code, and for some reason, z-index does not work in it, I do not understand anything. 500 times did work. Is it not here? I'm talking about opacity, why does it act on everyone, despite the z-index ?:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1251"> <style> #body_st { background-color:#ff5c5c; } #div_bg_img { position:relative; background-color:#33CC99; width:100%; height:300px; opacity:0.5; z-index:0; } #div_st { position:relative; background-color:#ffCC99; font:normal 14px trebuchet MS; width:30%; border:thin #666666 solid; left:50px; z-index:2; } </style> <title>TiTLE</title> </head> <body id="body_st"> <div id="div_bg_img"> <center> <span style="font:bold 28px trebuchet MS; color:#FFff00;">SPAN на DIV-1</span> </center> <br> <br> <div align="justify" id="div_st">DIV-2 <br> <hr> </div> </div> </body> </html> 

What is wrong here? On other projects, I registered the opacity to one of some DIV and it was perfectly translucent, why does it not work like that here? Or for opacity there is no concept for or before? And he stupidly affects everything?

  • 2
    My eyes!!! Discover a service like [jsfiddle] (jsfiddle.net), give examples of how it should be and how it is, if you want your chance to respond to increase - neoascetic
  • Not understood? Offline editors are already outdated? What the hell is my online debugger for? I see the code work anyway! And I see that here an element with opacity acts on another. STOP! He's in the parent div! And you need to either pull him out of there or prescribe his opacity! Everything! came to! losing qualifications :( - I_CaR
  • No, just vytashit from DIVa need. the opacity opacity in that DIV did nothing. - I_CaR
  • 3
    The online debugger is not needed by you, but by us, in order not to copy-paste into the editor and all that jazz. Have respect for those who ask for help. - neoascetic
  • 2
    Brought man. - ReinRaus

2 answers 2

I say, I brought him out of the DIV'a that was with opacity 0.5 and prescribed it my opacity 0.7 and z-index'y naturally worked. But for z-indexes to work on DIV in DIV'e (of the type of subsidiary), I haven’t yet met the code.

Simply, there are inherited properties and this must be taken into account, z-index - works inside the diva, is also inherited, but easily changed by the absolute values ​​for the entire document. Opcity is a property inherited and changed in the range of the parent diva. Actually, that's all, and since I left the opacity at all - rgba - taxis, although IE blathers its not the last word.

  • And a minus for opas? (Yuri Sosnov - user with authority +1) - I_CaR
  • to you "on the status online somehow ...", in what a problem? You are unlikely to be given just a minus for the opacity. - rnd_d

I had this problem: How to remove opacity from child divs . Will help RGBA instead of Opacity.

  • I say, I brought him out of the DIV'a that was with opacity 0.5 and prescribed it my opacity 0.7 and z-index'y naturally worked. But for z-indexes to work on DIV in DIV'e (of the type of subsidiary), I haven’t yet met the code. - I_CaR