滑动门技术:主要用来设计导航条,使它能够根据导航条菜单文本长度自动地调节宽度,这样可以用简单的背景小图来实现炫彩的导航条风格,大大减少网页的载入内容。
如使用如下的图to.png:
做一个小的导航条,代码如下:
<style type="text/css">
a {
text-decoration: none;
margin: 100px;
height: 33px;
display: inline-block;
background: url(img/to.png)no-repeat;
color: #fff;
line-height: 33px;
padding-left: 15px;
}
span{
display: inline-block;
height: 33px;
background: url(img/to.png)no-repeat right;
padding-right: 15px;
}
</style>
</head>
<body>
<a href="#">
<span id="">首页</span>
</a>
</body>
导航条的宽度主要取决如样式的padding-left和padding-right所设置的大小,如果想要宽度更大些就可以设置的更大些。
最后实现的效果如下图: