CSS之滑动
2018-11-20 本文已影响2人
追逐_chase

主要是利用CSS精灵图(background-position
)和盒子的padding
撑开宽度,类适应不同数字数的导航条
- 不能设置宽度
<a href="#">
<span>首页</span>
</a>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
*{
padding: 0;
margin: 0;
}
ul {
list-style: none;
margin-top: 200px;
margin-left: 200px;
}
a{
display: inline-block;
height: 33px;
background: url("./images/to.png") no-repeat;
padding-left: 15px;
}
span {
height: 33px;
line-height: 33px;;
display: inline-block;
background: url("./images/to.png") no-repeat center right;
padding-right: 15px;
color: #ffffff;
}
</style>
</head>
<body>
<ul>
<li>
<a href="#">
<span>这是什么观察表还不行</span>
</a>
</li>
</ul>
</body>
</html>
