I managed to remove the default arrow image for select element, using webkit-appearance, as I run this in chrome.
I am new to css, I got this idea constructing triangle from this codepen, I want to construct triangle of required size, as you see from snippet triangle is not neatly shaped.
I have some question on this,
- In the background-position 100% refers to select element width. Is this correct?
- What does these calculation calc(100% - 2.5em) 0.5em mean for background-position ?
- For background-size 20px 10px means from horizontally 20px and from top 10 px, am I correct?
- If yes making 0px 0px makes this entire image disappear from screen, 0 px takes reference from where in the screen?
select {
width:150px;
height:50px;
-webkit-appearance: none;
background-image:
linear-gradient(45deg,transparent 50% , black 50% ),
linear-gradient(135deg, black 50%, transparent 50%);
background-position:
calc(100% - 20px) calc(100% - 20px),
calc(100% - 15px) calc(100% - 20px),
calc(100% - 2.5em) 0.5em;
background-size:
20px 10px,
10px 10px,
5px 1px;
background-repeat: no-repeat;
}
<select class="version">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4"> 4</option>
<option value="5">5</option>
</select>