前端样式小技巧-W000:css悬浮

<html>
<head>
<title>CSSDemo</title>
<style type"text/css">
.hover-right-css
{
background-color:orange;
width:100px;
height:100px;
position:fixed;/*fixed总是以body为定位时的对象,总是根据浏览器的窗口来进行元素的定位,通过"left"、 "top"、 "right"、 "bottom" 属性进行定位。*/
right:0px;/*设置与右侧的距离*/
bottom:50px;/*设置与底部的距离*/
z-index:100;/*设置显示次序,数字越大显示越靠前*/
}
</style>
</head>
<body style="height:2000px;">
<div class="hover-right-css"></div>
</body>
</html>

像上面这样处理后,不管页面多高,div都会始终在右下角停止不动。

posted @ 2016-04-13 01:04  铲屎官盘盘  阅读(1577)  评论(0编辑  收藏  举报