コピペでできる!cssとhtmlのみでフォームのセレクトボックスをいい感じにするデザイン8選

CSS HTML
 2018.02.05
 2018.03.22

フォームはサイトにはかならず必要になってくるアイテムですが、わかりやすく間違えにくいものにしたいですよね。
わかりやすくていい感じのセレクトボックスを集めました。

また、最後の2つはラジオボタンを使ってセレクトボックスを作っています。
ピロっとでるプルダウンのデザインまで変更したい時はこちらが良いかもしれません。

browser:  65 11 20 10 

フォームのチェックボックスをわかりやすくするデザイン[8種]

シンプルなセレクトボックス

ニャン易度
<div class="cp_ipselect cp_sl01">
<select required>
<option value="" hidden>Choose</option>
<option value="1">cat</option>
<option value="2">dog</option>
<option value="3">rabbit</option>
<option value="4">squirrel</option>
</select>
</div>
.cp_ipselect {
overflow: hidden;
width: 90%;
margin: 2em auto;
text-align: center;
}
.cp_ipselect select {
width: 100%;
padding-right: 1em;
cursor: pointer;
text-indent: 0.01px;
text-overflow: ellipsis;
border: none;
outline: none;
background: transparent;
background-image: none;
box-shadow: none;
-webkit-appearance: none;
appearance: none;
}
.cp_ipselect select::-ms-expand {
display: none;
}
.cp_ipselect.cp_sl01 {
position: relative;
border: 1px solid #bbbbbb;
border-radius: 2px;
background: #ffffff;
}
.cp_ipselect.cp_sl01::before {
position: absolute;
top: 0.8em;
right: 0.9em;
width: 0;
height: 0;
padding: 0;
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #666666;
pointer-events: none;
}
.cp_ipselect.cp_sl01 select {
padding: 8px 38px 8px 8px;
color: #666666;
}

シンプルなセレクトボックス

ニャン易度
<div class="cp_ipselect cp_sl02">
<select required>
<option value="" hidden>Choose</option>
<option value="1">cat</option>
<option value="2">dog</option>
<option value="3">rabbit</option>
<option value="4">squirrel</option>
</select>
</div>
.cp_ipselect {
overflow: hidden;
width: 90%;
margin: 2em auto;
text-align: center;
}
.cp_ipselect select {
width: 100%;
padding-right: 1em;
cursor: pointer;
text-indent: 0.01px;
text-overflow: ellipsis;
border: none;
outline: none;
background: transparent;
background-image: none;
box-shadow: none;
-webkit-appearance: none;
appearance: none;
}
.cp_ipselect select::-ms-expand {
display: none;
}
.cp_ipselect.cp_sl02 {
position: relative;
border: 1px solid #bbbbbb;
border-radius: 2px;
background: #ffffff;
}
.cp_ipselect.cp_sl02::before {
position: absolute;
top: 0.8em;
right: 0.9em;
width: 0;
height: 0;
padding: 0;
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #666666;
pointer-events: none;
}
.cp_ipselect.cp_sl02:after {
position: absolute;
top: 0;
right: 2.5em;
bottom: 0;
width: 1px;
content: '';
border-left: 1px solid #bbbbbb;
}
.cp_ipselect.cp_sl02 select {
padding: 8px 38px 8px 8px;
color: #666666;
}

シンプルなセレクトボックス 文字色変更

ニャン易度
<div class="cp_ipselect cp_sl03">
<select required>
<option value="" hidden>Choose</option>
<option value="1">cat</option>
<option value="2">dog</option>
<option value="3">rabbit</option>
<option value="4">squirrel</option>
</select>
</div>
.cp_ipselect {
overflow: hidden;
width: 90%;
margin: 2em auto;
text-align: center;
}
.cp_ipselect select {
width: 100%;
padding-right: 1em;
cursor: pointer;
text-indent: 0.01px;
text-overflow: ellipsis;
border: none;
outline: none;
background: transparent;
background-image: none;
box-shadow: none;
-webkit-appearance: none;
appearance: none;
}
.cp_ipselect select::-ms-expand {
display: none;
}
.cp_ipselect.cp_sl03 {
position: relative;
border-radius: 2px;
border: 2px solid #da3c41;
background: #ffffff;
}
.cp_ipselect.cp_sl03::before {
position: absolute;
top: 0.8em;
right: 0.8em;
width: 0;
height: 0;
padding: 0;
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #da3c41;
pointer-events: none;
}
.cp_ipselect.cp_sl03 select {
padding: 8px 38px 8px 8px;
color: #da3c41;
}

角丸なセレクトボックス

ニャン易度
<div class="cp_ipselect cp_sl04">
<select required>
<option value="" hidden>Choose</option>
<option value="1">cat</option>
<option value="2">dog</option>
<option value="3">rabbit</option>
<option value="4">squirrel</option>
</select>
</div>
.cp_ipselect {
overflow: hidden;
width: 90%;
margin: 2em auto;
text-align: center;
}
.cp_ipselect select {
width: 100%;
padding-right: 1em;
cursor: pointer;
text-indent: 0.01px;
text-overflow: ellipsis;
border: none;
outline: none;
background: transparent;
background-image: none;
box-shadow: none;
-webkit-appearance: none;
appearance: none;
}
.cp_ipselect select::-ms-expand {
display: none;
}
.cp_ipselect.cp_sl04 {
position: relative;
border-radius: 2px;
border: 2px solid #da3c41;
border-radius: 50px;
background: #ffffff;
}
.cp_ipselect.cp_sl04::before {
position: absolute;
top: 0.8em;
right: 0.8em;
width: 0;
height: 0;
padding: 0;
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #da3c41;
pointer-events: none;
}
.cp_ipselect.cp_sl04 select {
padding: 8px 38px 8px 8px;
color: #da3c41;
}

角丸なセレクトボックス 背景塗り潰し

ニャン易度
<div class="cp_ipselect cp_sl05">
<select required>
<option value="" hidden>Choose</option>
<option value="1">cat</option>
<option value="2">dog</option>
<option value="3">rabbit</option>
<option value="4">squirrel</option>
</select>
</div>
.cp_ipselect {
overflow: hidden;
width: 90%;
margin: 2em auto;
text-align: center;
}
.cp_ipselect select {
width: 100%;
padding-right: 1em;
cursor: pointer;
text-indent: 0.01px;
text-overflow: ellipsis;
border: none;
outline: none;
background: transparent;
background-image: none;
box-shadow: none;
-webkit-appearance: none;
appearance: none;
}
.cp_ipselect select::-ms-expand {
display: none;
}
.cp_ipselect.cp_sl05 {
position: relative;
border-radius: 2px;
border-radius: 50px;
background: #da3c41;
}
.cp_ipselect.cp_sl05::before {
position: absolute;
top: 0.8em;
right: 0.8em;
width: 0;
height: 0;
padding: 0;
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #ffffff;
pointer-events: none;
}
.cp_ipselect.cp_sl05 select {
padding: 8px 38px 8px 8px;
color: #ffffff;
}

フォーカスで下線の色が真ん中から替わる

ニャン易度
<div class="cp_ipselect">
<select class="cp_sl06" required>
<option value="" hidden disabled selected></option>
<option value="1">cat</option>
<option value="2">dog</option>
<option value="3">rabbit</option>
<option value="4">squirrel</option>
</select>
<span class="cp_sl06_highlight"></span>
<span class="cp_sl06_selectbar"></span>
<label class="cp_sl06_selectlabel">Choose</label>
</div>
.cp_ipselect {
position: relative;
width: 90%;
margin: 2em auto;
text-align: center;
}
.cp_sl06 {
position: relative;
font-family: inherit;
background-color: transparent;
width: 100%;
padding: 10px 10px 10px 0;
font-size: 18px;
border-radius: 0;
border: none;
border-bottom: 1px solid rgba(0,0,0, 0.3);
}
.cp_sl06:focus {
outline: none;
border-bottom: 1px solid rgba(0,0,0, 0);
}
.cp_ipselect .cp_sl06 {
appearance: none;
-webkit-appearance:none
}
.cp_ipselect select::-ms-expand {
display: none;
}
.cp_ipselect:after {
position: absolute;
top: 18px;
right: 10px;
width: 0;
height: 0;
padding: 0;
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid rgba(0, 0, 0, 0.3);
pointer-events: none;
}
.cp_sl06_selectlabel {
color: rgba(0,0,0, 0.5);
font-size: 18px;
font-weight: normal;
position: absolute;
pointer-events: none;
left: 0;
top: 10px;
transition: 0.2s ease all;
}
.cp_sl06:focus ~ .cp_sl06_selectlabel, .cp_sl06:valid ~ .cp_sl06_selectlabel {
color: #da3c41;
top: -20px;
transition: 0.2s ease all;
font-size: 14px;
}
.cp_sl06_selectbar {
position: relative;
display: block;
width: 100%;
}
.cp_sl06_selectbar:before, .cp_sl06_selectbar:after {
content: '';
height: 2px;
width: 0;
bottom: 1px;
position: absolute;
background: #da3c41;
transition: 0.2s ease all;
}
.cp_sl06_selectbar:before {
left: 50%;
}
.cp_sl06_selectbar:after {
right: 50%;
}
.cp_sl06:focus ~ .cp_sl06_selectbar:before, .cp_sl06:focus ~ .cp_sl06_selectbar:after {
width: 50%;
}
.cp_sl06_highlight {
position: absolute;
top: 25%;
left: 0;
pointer-events: none;
opacity: 0.5;
}

ラジオボタンを使って作るセレクトボックス

ニャン易度
Choose
<div class="cp_ipselect">
<input type="radio" name="option">
<i class="toggle cp_sl07_arrowdown"></i>
<i class="toggle cp_sl07_arrowup"></i>
<span class="cp_sl07_selectlabel">Choose</span>
<label class="option">
<input type="radio" name="option">
<span class="cp_sl07_title">cat</span>
</label>
<label class="option">
<input type="radio" name="option">
<span class="cp_sl07_title">dog</span>
</label>
<label class="option">
<input type="radio" name="option">
<span class="cp_sl07_title">rabbit</span>
</label>
<label class="option">
<input type="radio" name="option">
<span class="cp_sl07_title">squirrel</span>
</label>
</div>
.cp_ipselect {
position: relative;
display: block;
overflow: hidden;
width: 90%;
height: 100%;
margin: 2em auto;
border-radius: 3px;
color: #ffffff;
}
.cp_ipselect > i.toggle {
position: absolute;
z-index: 4;
top: 1.6em;
right: 1.5em;
color: #ffffff;
}
.cp_ipselect .cp_sl07_arrowup:before {
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
padding: 0;
content: '';
pointer-events: none;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-left: 6px solid transparent;
-webkit-transition: all 250ms cubic-bezier(.4,.25,.3,1);
transition: all 250ms cubic-bezier(.4,.25,.3,1);
}
.cp_ipselect .cp_sl07_arrowdown:before {
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
padding: 0;
content: '';
pointer-events: none;
border-top: 6px solid #ffffff;
border-right: 6px solid transparent;
border-left: 6px solid transparent;
-webkit-transition: all 250ms cubic-bezier(.4,.25,.3,1);
transition: all 250ms cubic-bezier(.4,.25,.3,1);
}
.cp_ipselect .cp_sl07_title, .cp_ipselect .cp_sl07_selectlabel {
position: relative;
display: block;
width: 100%;
height: 100%;
padding: 1em 1em;
cursor: pointer;
border-top: 1px solid rgba(0, 0, 0, 0.05);
background: #da3c41;
}
.cp_ipselect > input {
position: absolute;
z-index: 1;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
cursor: pointer;
opacity: 0;
}
.cp_ipselect > input:checked ~ i.toggle.cp_sl07_arrowdown {
display: none;
}
.cp_ipselect > input:checked ~ i.toggle.cp_sl07_arrowup {
display: block;
}
.cp_ipselect > input:checked div.options label.option .cp_sl07_title {
display: none !important;
}
.cp_ipselect > input:not(:checked) {
z-index: 4;
}
.cp_ipselect > input:not(:checked) ~ label.option > span.cp_sl07_title {
display: none;
}
.cp_ipselect > input:not(:checked) ~ i.toggle.cp_sl07_arrowup {
display: none;
}
.cp_ipselect > input:not(:checked) ~ i.toggle.cp_sl07_arrowdown {
display: block;
}
.cp_ipselect > span.cp_sl07_selectlabel {
position: relative;
z-index: 0;
display: inline-block;
width: 100%;
color: #ffffff;
border-top: 0;
}
.cp_ipselect label.option {
z-index: 1;
display: block;
overflow: hidden;
width: 100%;
transition: all 1s ease-out;
}
.cp_ipselect label.option span.cp_sl07_title {
position: relative;
z-index: 2;
transition: 0.3s ease-out;
}
.cp_ipselect label.option span.cp_sl07_title:hover {
color: #ffffff;
background: #1b2538;
}
.cp_ipselect label.option input {
display: none;
}
.cp_ipselect label.option input:checked ~ span.cp_sl07_title {
position: absolute;
z-index: 3;
top: 0;
display: block;
width: 100%;
color: inherit;
border-top: 0;
background: #1b2538;
box-shadow: none;
}

ラジオボタンを使って作るセレクトボックス2

ニャン易度
  • Choose
<div class="cp_ipselect">
<ul class="cp_sl08">
<li>
<input class="cp_sl08_close" type="radio" name="awesomeness" id="close" value=""/>
<span class="cp_sl08_label cp_sl08_placeholder">Choose</span>
</li>
<li class="cp_sl08_items">
<input class="cp_sl08_expand" type="radio" name="option08" id="opener"/>
<label class="cp_sl08_closeLabel" for="close"></label>
<ul class="cp_sl08_options">
<li>
<input class="cp_sl08_input" type="radio" name="option08" id="cat"/>
<label class="cp_sl08_label" for="cat">cat</label>
</li>
<li>
<input class="cp_sl08_input" type="radio" name="option08" id="dog"/>
<label class="cp_sl08_label" for="dog">dog</label>
</li>
<li>
<input class="cp_sl08_input" type="radio" name="option08" id="rabbit"/>
<label class="cp_sl08_label" for="rabbit">rabbit</label>
</li>
<li>
<input class="cp_sl08_input" type="radio" name="option08" id="squirrel"/>
<label class="cp_sl08_label" for="squirrel">squirrel</label>
</li>
</ul>
<label class="cp_sl08_expandLabel" for="opener"></label>
</li>
</ul>
</div>
* {
position: relative;
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border-color: inherit;
}
.cp_ipselect {
display: block;
width: 90%;
height: 100%;
margin: 2em auto;
}
.cp_ipselect ul {
list-style: none;
padding: 0;
}
.cp_ipselect input {
color: inherit;
font: inherit;
margin: 0;
background: transparent;
outline: none;
border: none;
border-radius: 0;
-webkit-appearance: none;
appearance: none;
display:none;
}
.cp_sl08 {
width: 100%;
height: 100%;
cursor: pointer;
background-color: white;
-webkit-box-shadow: 0 2px 0 white;
box-shadow: 0 2px 0 white;
border-radius: 2px;
}
.cp_sl08_expand {
width: 0;
height: 40px;
position: absolute;
top: 0;
right: 0;
}
.cp_sl08_expand::after {
position: absolute;
top: 1.2em;
right: 0.5em;
width: 0;
height: 0;
padding: 0;
content: '';
pointer-events: none;
border-top: 6px solid rgba(0, 0, 0, 0.3);
border-right: 6px solid transparent;
border-left: 6px solid transparent;
-webkit-transform: translate(-50%, -50%) rotate(0deg) scaleY(1.75);
transform: translate(-50%, -50%) rotate(0deg) scaleY(1.75);
-webkit-transition: all 250ms cubic-bezier(0.4,0.25,0.3,1);
transition: all 250ms cubic-bezier(0.4,0.25,0.3,1);
z-index: 2;
opacity: 0.6;
}
.cp_sl08_expand:hover::after {
opacity: 1;
}
.cp_sl08_expand:checked::after {
-webkit-transform: translate(-50%, -50%) rotate(180deg) scaleX(-1) scaleY(1.75);
transform: translate(-50%, -50%) rotate(180deg) scaleX(-1) scaleY(1.75);
}
.cp_sl08_expandLabel {
display: block;
width: 100%;
height: 40px;
position: absolute;
top: 0;
left: 0;
cursor: pointer;
}
.cp_sl08_close {
display: none;
}
.cp_sl08_closeLabel {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
display: none;
}
.cp_sl08_items {
width: 100%;
position: absolute;
top: 0;
left: 0;
border: 2px solid #da3c41;
border-radius: 2px;
padding-top: 40px;
}
.cp_sl08_input {
display: none;
}
.cp_sl08_label {
-webkit-transition: all 250ms cubic-bezier(0.4,0.25,0.3,1);
transition: all 250ms cubic-bezier(0.4,0.25,0.3,1);
display: block;
height: 0;
line-height: 40px;
overflow: hidden;
color: #3e3e3e;
background-color: #ffffff;
cursor: pointer;
padding-left: 20px;
}
.cp_sl08_placeholder {
height: 40px;
vertical-align: middle;
position: absolute;
top: 0;
left: 0;
opacity: 0.6;
background-color: transparent;
}
.cp_sl08_expand:checked + .cp_sl08_closeLabel {
display: block;
}
.cp_sl08_expand:checked + .cp_sl08_closeLabel + .cp_sl08_options .cp_sl08_label {
height: 40px;
}
.cp_sl08_expand:checked + .cp_sl08_closeLabel + .cp_sl08_options .cp_sl08_label:hover {
background-color: #f7f7f7;
}
.cp_sl08_expand:checked + .cp_sl08_closeLabel + .cp_sl08_options + .cp_sl08_expandLabel {
display: none;
}
.cp_sl08_input:checked + .cp_sl08_label {
height: 40px;
margin-top: -40px;
}

ラジオボタンの装飾についてはこちら

copypet.jp

コピペでできる!cssとhtmlのみでフォームのラジオボタンをわかりやすくするデザイン10選 | copypet.jp

フォームはサイトにはかならず必要になってくるアイテムですが、わかりやすく間違えにくいものにしたいですよね。 ラジオボタン[input type="radio"]のデザインにエフェクトを追加することで、 今までよりワンランク上のわかりやすさを手に入れましょう。…

copypet.jp

記事を見る

copypet.jp

CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。

More Info

こんな記事はいかがですか?