I have a page with structure like this. I want to divide the page into 6 sections so I have made 6 outer div
s.
<body> <div id="header"> <img /> </div> <div id="pageTitle"> title of page </div> <div id="section1" class="section"> <div class="section-title"> section 1 </div> <form> <input /> </form> </div> <div id="section2" class="section"> <div class="section-title"> section 2 </div> <form> <input /> </form> </div> <div id="section3" class="section"> <div class="section-title"> section 3 </div> <form> <input /> </form> </div> <div id="nav"> <a href="url" /> </div> </body>
the problem is that when i try to zoom into the page by using Ctrl++
in firefox
or chrome
the contents of the div
s get overlapped on each other even when I am specifying all properties like top
,width
,height
,left
in percentages. now because percentages are relative units this should not happen.
#header { position:absolute; top:2%; width:90%; height:50%; } #pageTitle { position:absolute; top:30%; left:20em; } .section { margin:20px; border:10px; width:60%; height:33%; } .section-title { position:absolute; font-size:1.4em; left:70%; margin:10px; top:10%; width:60%; height:15% } #section1 { position:absolute; top:40%; } #section2 { position:absolute; top:70%; } #section3 { position:absolute; top:100%; } form { position:absolute; top:30%; height:70%; } label { display:block; width:75%; font-size:1em; } #nav { position:absolute; top:140%; }
In some other page where I was using pixels instead of percentages the content didn't overlap on zooming into the page but pixels are absolute units. What's wrong?
Pixels are the dots on the screen so when I zoom in do pixels become bigger?