样式:
<style type="text/css">
body{_background-attachment:fixed; _background-image:url(nothing);}
#status-box{width:100px; height:100px; color:#FFF; background-color:black; position:fixed; _position:absolute; bottom:0;_top:expression(documentElement.scrollTop+document.documentElement.clientHeight-100); right:0;}
#cs{background-color:#ccc;width:200px;height:120px;position:absolute;left:100px;top:100px;}
</style>
body:
<body>
<div id="cs">随页面走动</div>
<div style="height:900px;"></div>
<div id="status-box">静态层</div>
</body>
本文深入解析并实践CSS样式中body元素的背景固定与动态变化,通过设置#status-box的绝对定位与相对定位实现元素的随页面滚动而变化与保持静止效果。同时展示了如何利用表达式动态调整元素位置,为前端开发者提供实用的布局技巧。
704

被折叠的 条评论
为什么被折叠?



