滑动门:通过推拉的方式打开门
滑动门的核心原理:小图压大图,大图在伸展
素材:
ao.png
to.png
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
<!--清除干净-->
* {
margin:0;
padding: 0;
}
a {
display: inline-block;
margin:50px;
height: 50px;
background:url(images/ao.png) no-repeat;
/* 千万不能给狂赌 写死宽度不对滴,我们要推拉门 自由缩放 但可以用padding撑开盒子*/
padding-left: 15px;
/* background-position: -500px -597px; */
color:#fff;
text-decoration: none;
line-height: 50px;
}
a span {
display: inline-block;
/* margin: 120px; */
height: 50px;
background: url(images/ao.png) no-repeat right;
/* span不能给宽度利用padding挤开 我要span 右边的的圆角 所以 背景位置 右对齐 */
padding-right:15px ;
/* background-position: -244px -597px; */
text-align: center;
line-height: 50px;
color:#fff;
font-weight: 700;
text-decoration: none;
}
</style>
</head>
<body>
<a href="#">
<span>首页</span>
</a>
<a href="#">
<span>简介</span>
</a>
<a href="#">
<span>图片</span>
</a>
<a href="#">
<span>基地</span>
</a>
<a href="#">
<span>日常</span>
</a>
<a href="#">
<span>服务中心</span>
</a>
</body>
</html>
展示: