Style select HTML element with SCSS

by Zsanett Tamás

HTML

<div class="amazing-select-wrap">
  <div class="cool-select">
      <span class="arrow"></span>
      <select>
        <option>Eat ()</option>
        <option>Sleep ()</option>
        <option>Code ()</option>
        <option>Repeat ()</option>
      </select>
  </div>
</div>

SCSS

.amazing-select-wrap {
    padding: 4em 1em;
    text-align: center;
    margin-bottom: 2em;
    background: #8cc38c;
}

.cool-select {
  font-size: 16px;
  position: relative;
  display: inline-block;
  
  & select {
    outline: none;
    -webkit-appearance: none;
    display: block;
    padding: 1.2em 3em 1.3em 1.5em;
    margin: 0;

    transition: border-color 0.2s;
    border: 5px solid #cab1c2;
    border-radius: 5px;

    background: #fff;
    color: #555;
    line-height: normal;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
  }
  & .arrow {
    background: #fff;
    bottom: 5px;
    position: absolute;
    right: 5px;
    top: 5px;
    width: 50px;
    pointer-events: none;
    
    &:before {
      content: '';
      position: absolute;
      top: 50%;
      right: 24px;
      margin-top: -5px;
      pointer-events: none;
      border-top: 10px solid #EB5168;
      border-left: 10px solid transparent;
      border-right: 10px solid transparent;
    }
    
    &:after {
      content: '';
      position: absolute;
      top: 50%;
      right: 28px;
      margin-top: -5px;
      pointer-events: none;
      border-top: 6px solid #fff;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
    }
  }
}