Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to add a before element in selection box?

I’m trying to add an SVG image before the select input box. Here is the code

<select class="rankings_selection" name="" id="">
    <option value="">Last 7 days</option>
    <option value="">Last 3 days</option>
</select>

This is what I’m trying to achieve

This is what I'm trying to achieve

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I think you should try styles for custom select

.custom_select {
  display: inline-flex;
  border: 1px solid black;
  border-radius: 8px;
  overflow: hidden;
  padding: 4px;
}

.rankings_selection {
  border: none;
  outline: none;
  padding: 0;
}
<div class="custom_select">
  <img src='https://picsum.photos/24/24' />
  <select class="rankings_selection" name="" id="">
    <option value="">Last 7 days</option>
    <option value="">Last 3 days</option>
  </select>
  <div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading