I have been trying to make this work for sometime but no success for two days now.
I need to truncate/hide the text in a select box in the middle of it using CSS only. The rest of the field (the right side) should remain blank/white and the background image should be last to the right. Problem to the solutions I have tried is that the width of the select box needs to be changed and in this case the width needs to stay unchanged in order to keep the background arrow at it's current location. Something like this:
Maybe someone would have a bright idea (JavaScript is not a possible option):
The HTML here:
<div class="dropdown">
<select>
<option value="">Some Text</option>
<option value="">Some More Text2</option>
<option value="">Some More More More Longer Text</option>
</select>
</div>
And the CSS here:
.dropdown{
width:150px;
border: 1px solid #cfcfcf;
height: auto;
border-radius: 5px;
padding:3px 4px 4px;
position: relative;
z-index: 0;
overflow:hidden;
}
.dropdown select{
border: none;
background-color: transparent;
outline: none;
padding: 1px 0 0 5px;
width:165%;
background: url(http://i57.tinypic.com/nnmgpy_th.png) no-repeat right;
background-position: 55%;
}
JSFiddle here: http://jsfiddle.net/pazzesco/r6c9zcpc/7/