fl00r
fl00r

Reputation: 83680

Relative positioning sprites

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.

Upvotes: 0

Views: 102

Answers (2)

thirtydot
thirtydot

Reputation: 228162

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)

Upvotes: 2

avetarman
avetarman

Reputation: 1252

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?

Upvotes: 1

Related Questions