不設(shè)置botton,就不顯示a標(biāo)簽?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
??? <title>Javascript 回到頂部效果</title>
?? ?<!-- <link rel="stylesheet" type="text/css" href="style.css" /> -->
?? ?<style>
?? ??? ?.box{
?? ??? ??? ??? ?width:1190px;
?? ??? ??? ??? ?margin:0 auto;
?? ??? ?}
?? ??? ?#btn{
?? ??? ??? ?position:fixed;
?? ??? ??? ?width:40px;
?? ??? ??? ?height:40px;
?? ??? ??? ?left:50%;
?? ??? ??? ?/*bottom:30px;*/
?? ??? ??? ?margin-left: 610px;
?? ??? ??? ?background:url(images/top_bg.jpg) no-repeat left top;
?? ??? ?}
?? ?</style>
</head>
<body>
?? ?<div>
?? ??? ?<img src="images/tb_bg.jpg" />
?? ?</div>
?? ?<a href="javascript:;" id="btn" title="回到頂部"></a>
</body>
</html>
2016-07-20
position:fixed;固定定位,需要結(jié)合bottom: ? ? px;(或者top: ? ? px)和left: ? ?px; ? margin-left: ? ? px;才能實(shí)現(xiàn)固定定位的效果。所謂固定定位,就是把這個(gè)元素固定定位在瀏覽器窗口的固定位置,讓它不隨其他元素的變化而變化。
2016-07-05
定位中設(shè)置 bottom:30px ?就是距離底部30px ?如果設(shè)置bottom:0 就是在底部顯示 ?默認(rèn)是top:0 頂部顯示
2016-06-25
沒有樣式 就一個(gè)標(biāo)簽,沒寬高怎么顯示