Reputation:
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 absolute
and relative
positioning but it's not working either.
sidenav bar
<div class="left-nav clearfix" style="background-color:#00859d; position:relative;">
modal
<div class="container" style="width:100%; margin-left:30%; position:absolute;">
How can I set a div over another div?
Upvotes: 1
Views: 626
Reputation:
Use the z-index
on both and
and add style relative
on modal
and absolute
on side nav bar
and set z-index
on modal
as 0 and as 1 on side nav bar
Upvotes: 1
Reputation: 603
Use the z-index
property. Set a z-index: 1
for the nav and set a higher z-index for the modal.
Upvotes: 2