2019-3-2 网页设计-菜单背景定位和反转

版权声明:本文为博主原创文章,博主QQ:289102120,博主Mobile:15891712396 https://blog.csdn.net/vinglemar/article/details/88071915
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
ul {
	list-style-type: none;
}
li {
	height: 58px;
	width: 160px;
	float: left;
}
a {
	display: block;
	height: 100%;
	width: 100%;
	line-height: 500px;
	overflow: hidden;
	background-image: url(Pic/menu.gif);
	background-repeat: no-repeat;
}
a.bg1{	
	background-position: 0 0;	
}
a.bg2{
	background-position: 0 -70px;
}
a.bg3{
	background-position: 0 -140px;
}
a.bg4{
	background-position: 0 -210px;
}
a:hover.bg1{	
	background-position: -170px 0;	
}
a:hover.bg2{	
	background-position: -170px -70px;	
}
a:hover.bg3{	
	background-position: -170px -140px;	
}
a:hover.bg4{	
	background-position: -170px -210px;	
}
</style>
</head>
<body>
<ul>
  <li><a class="bg1" href="#">美容健康</a></li>
  <li><a class="bg2" href="#">乐活情爱</a></li>
  <li><a class="bg3" href="#">原创专题</a></li>
  <li><a class="bg4" href="#">自媒体</a></li>
</ul>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/vinglemar/article/details/88071915