CSS小技巧

2020-10-12  本文已影响0人  consolelog

css精灵图

英文名:css sprites
也可以叫做雪碧图、精灵图、css贴图定位、css图像拼合

原理和好处

css滑动门技术

为了使各种特殊的背景能够自动适应文字的多少,我们就需要使用滑动门技术

实现原理:
使用css精灵技术、使用padding撑开盒子来实现滑动门

代码

<a href="#"><span>首页</span></a>
a {
    display: inline-block;
    height: 33px;
    background: url("./image.png") no-repeat left;
    padding-left: 15px;
    line-height: 33px;
    text-decoration: none;
    color: #fff;
}

span {
    display: inline-block;
    height: 33px;
    background: url("./imang.png") no-repeat right;
    padding-right: 15px;
}

image.png
上一篇 下一篇

猜你喜欢

热点阅读