以下是 float 和 fixed 的标准用法:
<html>
<head>
<style type="text/css">
#bigDiv
{
background-color: red;
height: 2000px;
width: 100px;
float: left;
}
#littleDiv
{
background-color: green;
height: 400px;
width: 200px;
float: left;
}
#littleDivFixed
{
background-color: blue;
height: 100px;
width: 200px;
position: fixed;
}
</style>
</head>
<body>
<div id="bigDiv">
</div>
<div id="littleDiv">
</div>
<div id="littleDivFixed">
</div>
</body>
</html>
_
- "littleDiv" div在"bigDiv" div的右侧,但不随滚动而移动,
- 相反,"littleDivFixed" div会滚动,但相对于"bigDiv" div的位置不正确(它始终卡在显示器的左侧)。
_
是否可能有一个div混合这两种行为:
- 始终在"bigDiv" div的右侧(与"bigDiv" div保持10px的距离),
- 始终在显示器上(距离顶部保持10px的距离)?
_
非常感谢您的帮助。