1,使用a充当按钮,或者点击区域,要设置a的
.a_button{
background-color: #4CAF50;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
width:100%;
height:100%;
}
或者下面:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<style>
.mainTop {
background: #eee;
font-weight: bold;
border-radius:5px;
color: #333;
text-align: center;
height:100px;
line-height: 100px;
}
.a_fill{
display: block;
height: 100%;
width: 100%; }
</style>
</head>
<body>
<div class="mainTop">
<a class="a_fill" href="tab/index.html"> <span style="text-align: center"><img src="img/logo.png"
alt="" class="mainLogo" />大地灯饰</span>
</a>
</div>
</body>
</html>
2,fixed的使用
使用top,left,right,bottom控制位置