html置顶语句,HTMLdiv层置顶置底.html

本文探讨了CSS中绝对定位(absolute)和固定定位(fixed)的使用,通过示例展示了如何创建一个始终位于顶部的导航栏。讨论了`.aaa`、`.bbb`、`.ccc`和`.ddd`类在布局中的作用,以及在不同浏览器下的兼容性解决方案。
摘要由CSDN通过智能技术生成
why?

< !-- * {

margin: 0;

padding: 0;

}

body {

margin: 0 auto;

font: 12px/20px tahoma Simsun Arial;

color: #fff;

background-color: #FFF;

text-align: center;

}

.aaa {

width: 150px;

background: Blue;

position: absolute;

left: 0;

top: 0;

}

.bbb {

width: 150px;

background: Blue;

position: absolute;

right: 0;

top: 0;

}

.ccc {

width: 150px;

position: absolute;

top: 100%;

left: 0;

margin-top: -20px;

background: Blue;

}

.ddd {

width: 150px;

position: absolute;

top: 100%;

right: 0;

margin-top: -20px;

background: Blue;

}

.aa {

width: 50px;

position: fixed;

background: Black;

_position: absolute;

_top: expression(eval(document.documentElement.scrollTop));

z-index: 1000;

left: 0;

top: 0;

}

.bb {

width: 50px;

position: fixed;

background: Black;

_position: absolute;

_top: expression(eval(document.documentElement.scrollTop));

z-index: 1000;

right: 0;

top: 0;

}

.a {

color: #000;

}

-->

AAA
BBB
A
B

A层和B层会随滚动条移动永久置顶

CCC
DDD

一键复制

编辑

Web IDE

原始数据

按行查看

历史

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值