【发布时间】:2009-01-09 10:40:24
【问题描述】:
在 HTML 页面中,如果我将一些 <div>s 与“right: 0px”对齐,它们看起来都非常好,正如我所期望的那样。但是,如果我缩小浏览器窗口并出现水平滚动条,当我向右滚动页面时,我会看到一个意想不到的空白(而不是我的<div>s 的背景颜色)。我的<div>s 似乎与页面的可见区域对齐。请看下面的示例代码:
<html>
<head>
<style>
<!--
#parent {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
background-color: yellow;
}
#child {
position: absolute;
left: 100px;
top: 300px;
width: 1000px;
height: 400px;
background-color: blue;
}
-->
</style>
</head>
<body>
<div id="parent"><div id="child">some text here</div></div>
</body>
</html>
有没有办法让“right:0px”属性使控件相对于整个页面的大小对齐,而不仅仅是可见区域?
谢谢。
【问题讨论】: