How do you layer a div element ontop of other elements?
I want to make a slightly translucent div element using the opacity css option then place
the div on top of the webpage to darken it then place another div with a form on top of that.
I tried using the z-index but i couldn't get it to work very well.
How would i do this? Is there a better way to do this?
Here is the code, am i doing something wrong?
<div style="opacity:.3; width:200; height:200; background-color:#222021; position:relative; z-index:1000;"></div>
<div style="z-index:100;">
<form name="testform" >
<input type="text" placeholder="First Name"required/><br>
<input type="text" placeholder="Last Name" required/><br>
<input id="submit" type="submit" value="Submit" />
</form> </div>
I want the div to layer on top of the other elements.(the form in this case.)