よりシンプルな下線のみのInput Textデザインですが、フォーカスでふわっと下線の色が替わります。
<div class="cp_iptxt">
<label class="ef">
<input type="text" placeholder="お名前">
</label>
</div>
.cp_iptxt {
position: relative;
width: 80%;
margin: 40px 3%;
}
.cp_iptxt input[type='text'] {
font: 15px/24px sans-serif;
box-sizing: border-box;
width: 100%;
padding: 0.3em;
transition: 0.3s;
letter-spacing: 1px;
color: #aaaaaa;
border: none;
border-bottom: 2px solid #1b2538;
background: transparent;
}
.ef input[type='text']:focus {
border-bottom: 2px solid #da3c41;
outline: none;
}
CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。
@copypet_jp More Info