开发者

Using background-position with background-repeat for a CSS sprite

开发者 https://www.devze.com 2023-02-28 18:28 出处:网络
He开发者_Go百科re is the demo, and here is the sprite: I want to use the arrow in a markup, like this:

He开发者_Go百科re is the demo, and here is the sprite:

Using background-position with background-repeat for a CSS sprite

I want to use the arrow in a markup, like this:

<div class="tooltip">
    The tooltip
    <span class="arrow"></span>
</div>

Setting:

background-image: url(foobar.gif);
background-position: 0 -40px;
background-repeat: none;

does not seem to work (as expected). Any workaround?


Do you mean:

background-repeat:no-repeat ?


Use height and width exactly..

for example,

background-position: 0 -40px; 
background-repeat: no-repeat;
height:32px;
width:32px;

or use the sprites generators online and they will render both images and css..

eg: http://spritegen.website-performance.org/


hm try this:

background: url(foobar.gif) 0 -40px no-repeat transparent;

should be work.

0

精彩评论

暂无评论...
验证码 换一张
取 消