css - Problem with position absolute in ie7, div moves 10px to the right -


ive got problem on position absolute property on ie7. div moves 10px right. below code. ie8 , 9 works fine. id menu div im referring.

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type="text/css"> body{margin: 0 0 0 0; padding: 0 0 0 0;} #holder{width: 400px; height: 500px; margin: 0 auto;} #left{float: left; width: 50px; height: 500px; background-color: red;} #center{float: left; width: 300px; height: 500px; background-color: green;} #right{float: left; width: 50px; height: 500px; background-color: red;} #header{width: 300px; height: 70px; background-color: yellow;} #gal-holder{width: 280px; height: 70px; margin: 0 auto;} #gallery{width: 280px; height: 410px; background-color: orange;} #button{width: 400px; height: 45px; background-color: red; margin: 0 auto;} #menu{width: 300px; height: 45px; background-color: pink; position: absolute; z-index: 1000; top: 100px;} #content{width: 380px; height: 200px; margin: 0 auto; background-color: blue; padding: 10px; color: #fff;} #clear{height: 10px;} </style> </head> <body> <div id="holder">     <div id="left"></div>     <div id="center">         <div id="header"></div>         <div id="menu"></div>         <div id="gal-holder">             <div id="clear"></div>             <div id="gallery"></div>             <div id="clear"></div>         </div>     </div>     <div id="right"></div> </div> <div id="button"></div> <div id="content">sample text</div> </body> </html> 

add position:relative #center , left:0px #menu.

absolutely positioned elements positioned relative closest positioned parent. it's best give items want position left/right , top/bottom coordinate prevent weird results 1 found.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -