LoginSignup
23
22

More than 5 years have passed since last update.

cssだけでselectとシンプルな矢印

Last updated at Posted at 2017-12-12

スクリーンショット 2017-12-12 11.35.00.png

コード

html
<div class="selectWrap">
    <select class="select" name="" id="">
        <option value="">001</option>
        <option value="">002</option>
        <option value="">003</option>
    </select>
</div>
css
.selectWrap{
  width: 100%;
  position: relative;
  display: inline-block;
}
.selectWrap::after {
  content: '';
  width: 6px;
  height: 6px;
  border: 0px;
  border-bottom: solid 2px #b4b3b3;
  border-right: solid 2px #b4b3b3;
  -ms-transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
  position: absolute;
  top: 50%;
  right: 10px;
  margin-top: -4px;
}
.select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px;
  background: transparent;
  position: relative;
  z-index: 1;
  padding: 0 40px 0 10px;
  border: 1px solid #b4b3b3;
  border-radius: 2px;
}
select::-ms-expand {
    display: none;
}
23
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
22