79506697

Date: 2025-03-13 14:12:00
Score: 0.5
Natty:
Report link

2025 Version?

I've always wanted to, not only add custom drop-down arrow with svg images, but also color it with my CSS variables.

So here's how I did -

HTML:

// Wrap select element with div or something
<div class="container"> 
    <select>
        <option></option>
    </select>
</div>

CSS:

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.container {
    position: relative;
}

.container::after {
    content: "";
    position: absolute;
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg> ~ </svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg> ~ </svg>');
    top: 2px;
    right: 8px;
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--my-color);
    pointer-events: none;
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Jinwoo Lee