I am trying to get a magnifying glass as the background for my input element. The magnifying glass icon is part of a CSS sprite that looks like this:
You declared background-position
two times. The first one at the end of the background
short-hand property, the second one on the next line. Solution: Split all single background
rules like this (additionally, 0 -24px
is the correct value):
#search-form input[type="text"] {
background-image: url('http://i.stack.imgur.com/MFpLm.png');
background-repeat: no-repeat;
background-position: 0 -24px;
border: 1px solid #a9e2ff;
padding: 3px;
width: 200px;
font-size: 1em;
padding-left: 20px;
}
And now you can face the real problem with your design: other sprites will be visible in the input area if there are no sufficient space between them.