类似这样的
<div class="banner">
<a href="#"><img src="#" alt=""/></a>
</div>
1
luckylion 2015-04-30 17:07:54 +08:00
1:背景形式
2:通过JS获取可视范围,动态调整图片的maring值 |
2
gonghao 2015-04-30 17:34:36 +08:00
|
3
coraline 2015-04-30 17:52:25 +08:00
假设 img 100x100 px,外层设定为 40x40 px
a { position: relative; width: 40px; height: 40px; overflow: hidden; } img { position: absolute; left: 50%; margin-left: -50px; top: 50%; margin-top: -50px; } |
4
lifang 2015-06-29 23:24:37 +08:00 via Android
background:url(xxx.png) center center no-repeat;
|