Reputation: 9941
I'm trying to style a <select>
-Field.
(This is an IE10-only page, so interoperability is only my second concern...)
using:
select
{
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-image: url(images/select-open.png), linear-gradient(#e3dfdb 50%, #d3cec8);
background-position: right center;
background-repeat: no-repeat;
border: solid 1px #adadad;
border-radius: 3px;
cursor: pointer;
outline: none;
padding-bottom: 3px;
padding-left: 3px;
padding-right: 20px;
padding-top: 3px;
}
select::-ms-expand
{
display: none;
}
I get something like:
Now, if I modify the backgroud position to background-position: right 10px center;
then I get something like .
How can I position the image 10px from the right border while keeping the linear gradient "all the way"? BTW: I feel that adding 10px of transparency to the right side of my image is not an option ;-)
Upvotes: 1
Views: 416
Reputation: 157344
What you need to do is separate the position for both the backgrounds using a comma..
background-position: FIRST_IMAGE_POSITION, SECOND_IMAGE_POSITION;
So in your case, image is first and gradient is second so it should be..
select {
background-position: right center, 0 0;
/* Use pixels instead of right and center for better control...
where 1st parameter is x and the other parameter is y
*/
/* Rest stays the same */
}
Upvotes: 6