(This is for particular styling of the option Select menu, not the overall styling/incapabilities of styling select menus)
I'm wondering how I can fade the text out on the overflow of the selected option in a select menu. For example, in the JSFiddle, where "Mercedes" is cut at the moment, it would fade out to the edge using a CSS gradient background style.
This is a similar answer, but I can't seem to get to work on select menu, maybe it's not possible?
<div class="selectbox">
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
</div>
CSS:
.selectbox {
border: 1px solid #ccc;
width: 50px;
border-radius: 3px;
background: #fafafa no-repeat 90% 50%;
}
.selectbox select:after {
content: '';
position: absolute;
top: 0;
right: 0;
width: 30%;
height: 100%;
position: absolute;
right: 0;
bottom: 0;
width: 100%;
height: 50%;
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background-image: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background-image: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background-image: linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background-image: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%); pointer-events: none;
}
.selectbox select {
padding: 5px 8px;
width: 100%;
border: none;
box-shadow: none;
background: transparent;
background-image: none;
-webkit-appearance: none;
background: #fafafa no-repeat 90% 50%;
}
.selectbox select:focus {
outline: none;
}
Here's the attempt on: https://jsfiddle.net/nick_1002/7y5uezs5/
Any help is greatly appreciated :)