回到顶部-
<!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>
<style >
.box {
width:1190px;
margin:0 auto;
}
#btn {
width:40px;
height:40px;
position:fixed;
left:50%;
margin-left:590px;
bottom:30px;
background:url(http://img1.sycdn.imooc.com//535e0dc100010e9c00400080.jpg) no-repeat left top;
margin:0 auto;
}
#btn:hover {
background:url(http://img1.sycdn.imooc.com//535e0dc100010e9c00400080.jpg) no-repeat 0 -40px;
}
</style>
</head>
<body>
<div>
<img src="http://img1.sycdn.imooc.com//535e0ce800015b7511902787.jpg" />
</div>
<a href="javascript:;" id="btn" title="回到顶部"></a>
</body>
</html>
我哪个地方写错了么?为什么没法回到顶部,我复制到sublime里面也没法回到顶部,哪个地方有问题,望各位指出,非常感谢