user6656724
user6656724

Reputation:

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 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

Answers (3)

user6882159
user6882159

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

Ayyappan K
Ayyappan K

Reputation: 1186

You can give model z-index:1 then it will appear front.

Upvotes: 0

Dominofoe
Dominofoe

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

Related Questions