开发者

Relative positioning sprites

开发者 https://www.devze.com 2023-03-26 00:35 出处:网络
I can do background: url(/images/sprites.png) no-repeat 0 -22px; or background: url(/images/sprites.png) no-repeat top center;

I can do

background: url(/images/sprites.png) no-repeat 0 -22px;

or

background: url(/images/sprites.png) no-repeat top center;

What if I want to place my sprite on top开发者_运维百科 center? Like:

background: url(/images/sprites.png) no-repeat 0 -22px top center;

UPD

I have got a block with dynamic width. I want to put in its top center my image, that is part of sprite.


You can either use keywords such as top center, or explicit values such as 0 -22px.

There is no way to use both at the same time.

(you can of course use one of each, for example -22px top)


background: url(/images/sprites.png) no-repeat 0 -22px top center;

This is invalid.

top center is the same as 50% 0;

Can you describe what do you want exactly?

0

精彩评论

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