Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to control `div` overlapping in html

Tags:

html

css

overlap

I am creating a webpage, And I have two divs, A and B for instance. A's position is fixed and it's on top of the page, but B's position is absolute and is somewhere in the middle of the page. When they Overlap, B comes on top of A, But I want this to be the other way around. I want A to come on top of anything, but I don't know how to do that.

Please note that changing their positioning is not an option.

Thank You in advance. :)

like image 261
Makan Tayebi Avatar asked Mar 15 '13 19:03

Makan Tayebi


2 Answers

You can use z-index css setting to modifiy non-static positioned element order:

div#A { z-index: 2; }
div#B { z-index: 1; }

A will be displayed over B.

like image 120
aorcsik Avatar answered Oct 20 '22 00:10

aorcsik


use z-index value to adjust them accordingly to layer. its a style property: style="z-index:200"....

like image 25
Sri Tirupathi Raju Avatar answered Oct 19 '22 23:10

Sri Tirupathi Raju