讓某一個div固定在屏幕中的解決方法
發(fā)布時(shí)間:2014-02-17 11:10:15 作者:佚名
我要評論

讓某一個div固定在屏幕中的方法有很多,下面有個示例個人感覺還不錯,希望對大家有所幫助
position:fixed;
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
#low_right
{
position: fixed;
width: 90px;
height: 90px;
background: #eee;
bottom: 40px;
right: 20px;
background-color: #DCFCE9;
border: 8px double #06F867;
text-align: center;
padding: 10px;
margin: 10px;
}
</style>
</head>
<body>
<script type="text/javascript">
for (var i = 0; i < 100; i++) {
document.write((i + 1) + "
");
}
</script>
<div id="low_right">
右下角
</div>
</body>
</html>
復(fù)制代碼
代碼如下:<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
#low_right
{
position: fixed;
width: 90px;
height: 90px;
background: #eee;
bottom: 40px;
right: 20px;
background-color: #DCFCE9;
border: 8px double #06F867;
text-align: center;
padding: 10px;
margin: 10px;
}
</style>
</head>
<body>
<script type="text/javascript">
for (var i = 0; i < 100; i++) {
document.write((i + 1) + "
");
}
</script>
<div id="low_right">
右下角
</div>
</body>
</html>
相關(guān)文章
- 可能會有這樣的一個需求就是讓DIV一直固定在屏幕的某個位置,在某些情況下還是比較實(shí)用的,下面有個不錯的示例,感興趣的朋友可以參考下2013-11-05
- 下面小編就為大家?guī)硪黄O(shè)置一個DIV塊固定在屏幕中央的兩種方法(推薦)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-07-25