Depending on your situation and which browsers you want to support, this works (tested on IE7-8, Firefox):
background: url(...) no-repeat right 50%; border-right: 4px solid transparent;
Of course, if you have already set the border on the right, this will not help you.
Added to edit: If the above does not work, because you are using a border, and you do not care that IE7 (not sure if we are at that moment), and your width of the "icon" is known, then you can do:
.yourContainer {
position: relative;
}
.yourContainer:after {
content: ' ';
display: block;
position: absolute;
top: 0;
bottom: 0;
right: 4px;
width: 10px; //icon width
z-index: -1; //makes it act sort of like a background
background: url(...) no-repeat right 50%;
}
source
share