Ibrahim Shaikh Ibrahim Shaikh - 10 months ago 46
CSS Question

set div over another Div css

I am creating a web app and I want to open a modal on a button click of

sidenav bar
but the modal is opening behind the
sidenav bar
. I tried
positioning but it's not working either.

sidenav bar

<div class="left-nav clearfix" style="background-color:#00859d; position:relative;">


<div class="container" style="width:100%; margin-left:30%; position:absolute;">

How can I set a div over another div?

Answer Source

Use the z-index property. Set a z-index: 1 for the nav and set a higher z-index for the modal.