css:浮层

1.绝对浮层:

 <div id="floatTips" style="position:absolute;border:solid 1px #777;padding:3px;top:250px;left:500px;width:300px;height:300px;background:#cccccc;color:white;">
 <a href="#" οnclick=floatTips.style.display="none">close</a><br>


2.相对位置浮层:

需要父元素的position:relative(父元素的top、left可以为空)

子元素的浮层依然使用position:absolute即可

<div style="position:relative">
<div style="position:absolute;left:10px;right:10px">
11
</div>
</div>


3.浮层相对位置(top、right、left)

4.浮层居中显示:

使用top:50%,left:50%,并向左移动1/2个浮层宽度,向上移动1/2个浮层高度:

<div id="mr_test" style="position:absolute;z-index:999;top:10px;left: 50%;width:300px;height:250px;white-space:nowrap;line-height: 10px;border:0px;padding:0px;margin:0px;background:#cccccc;color:white;margin-left: -150px;top:50%;margin-top: -125px"></div>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值