我有一個DIV,即使在瀏覽器調整大小時,我也想始終保持在屏幕中央。另外還有一個浮動的右側DIV,它不應該與中央DIV重疊。居中div和浮動右分區
Chrome瀏覽器在中心離開屏幕左側或右側浮動DIV與中央DIV重疊時導致大量問題。
CSS
.center {
border-style: solid;
border-width: 1px;
background-color: #808080;
width: 650px;
height: 200px;
margin: auto;
}
.right {
border-style: solid;
border-width: 1px;
background-color: #808080;
width: 200px;
height: 200px;
float: right;
}
body {
border-style: dashed;
border-width: 1px;
}
HTML
<div class="right">right</div>
<div class="center">center</div>
您使用的是什麼版本的Chrome瀏覽器?我使用鉻18.0.1025.168,它看起來很好 –
在鉻19測試它,看起來不錯:[鏈接](http://jsfiddle.net/wLGj7/1/) – Luis