css - Absolute position is working fine on different resolutions even if there is no relative position element on the top of it -


i wondering i've heard absolute position messes page on different resolution. reason, working fine me without wrapping around relative element. how possible? want understand.

here css:

body { background-image:url('images.jpg'); background-repeat:repeat-x;  } 

.mainpage { margin-top:100px; width:900px; margin:auto; }

.gridline { content:"";  height:1px; background:-moz-linear-gradient(left, #ffffff 0%,#000000 50%,#ffffff 100%);  background:-webkit-linear-gradient(left, #ffffff 0%,#000000 50%,#ffffff 100%);  background:linear-gradient(left, #ffffff 0%,#000000 50%,#ffffff 100%); width:100%; display:block; } .empbox   { height:30px; background:-moz-linear-gradient(left, #ffffff 0%,#6c8483 50%,#ffffff 100%);  background:-webkit-linear-gradient(left, #ffffff 0%,#6c8483 50%,#ffffff 100%);  background:linear-gradient(left, #ffffff 0%,#6c8483 50%,#ffffff 100%); width:100%; display:block; color:white; margin-top:190px; padding-top:10px; clear:both;  }  .menu { color:black; margin-top:-110px; position:absolute; } .menu ul  {  list-style:none;  display:inline;  float:left;  padding-left:40px;  }  .menu li { float:left; margin-left:20px;}  .menu li:hover   {  padding:0px 15px 0px 15px;  font-size:xx-large;  font-style:italic;  border-bottom:3px solid #6c8483;  padding-bottom:10px;   }   .menu li {  text-decoration:none; font-style:oblique; color:black;  font-weight:bolder; font-size:large; }  .menuwrap   {   overflow:visible;   position:relative;  } 

html

<div class="menuwrap">     <div class="menu">         <ul>             <li><a href="#">home</a></li>             <li><a href="#">query</a></li>            <li><a href="#">reports</a></li>        </ul>     </div> </div> 

i point out haven't set in body element, picture background. , again, want understand avoid future problems. thought wrapping absolute inside relative avoids such issue, apparently nothing changes if remove relative. conducted test using chrome extension called resolution test. have question, when set element relative, relative to, body or element on top of it? , if there no element on top of it, relative body size , if there no width or height set body how functions?

thanks!

absolutely positioned elements relative container positioned relatively. if none specified, it's relative window. i've never heard of/see problems position , screen resolution... other fact browser might change width/height when resolution changes?

this regardless of if there set in css html/body width & height.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -