當我在我的瀏覽器上縮小很多時,Chrome瀏覽器的info_table
向下移動。它爲什麼這樣做?同樣當overflow: auto;
到section
時,它也會移動。我能做什麼?爲什麼div在瀏覽器縮小時移動?
的jsfiddle http://jsfiddle.net/PbwS8/3/
CSS
*{
font-size:100%;
margin: 0px;
padding: 0px;
}
body{
width: 100%;
}
#info_table{
float: left;
width: 480px;
margin: 40px 0px 0px 16px;
border-spacing: 0px 0px;
}
#left{
float:left;
margin: 60px 0px;
}
#photo{
float: left;
width: 176px;
height: 176px;
border: 1px solid black;
}
#section{
margin: 160px auto 0px;
width: 675.2px;
height: 320px;
#overflow: auto;
#border:1px solid black;
}
#choosephoto{
width: 64px;
}
#submitwords{
width: 72px;
height: 28px;
margin-left: 104px;
#border:1px solid purple;
}
#wrapper{
display: block;
box-shadow: 3px 10px 5px #888888;
margin: 0px auto;
margin-top: 48px;
width: 1024px;
height: 960px;
overflow: auto;
background:white;
}
HTML
<div id="section">
<body>
</body>
<form>
<div id="left">
<div id="photo">
</div>
<br/>
<input type="file" id="choosephoto" name="uploadphoto"/>
</div>
<table id="info_table">
<tr>
<td>Name:</td>
</tr>
<tr>
<td><input/></td>
</tr>
<tr>
<td>Info:</td>
</tr>
<tr>
<td><textarea></textarea></td>
</tr>
<tr>
<td><button type="submit" id="submitwords">Update</button></td>
</tr>
</table>
</form>
</div>
[幸運的猜測](http://jsfiddle.net/p44Zj/):也許是因爲1px邊框和一些舍入問題在各級縮放? – Jeroen
在Chrome瀏覽器上查看開發者控制檯顯示,邊界實際上是在'#photo'上從1.5015px更改爲2px,這會將寬度添加到其容器和(我假設)將信息框向下推。 – JustcallmeDrago
@JustcallmeDrago謝謝,這是因爲邊界上的照片。 – user2127833