[装飾系]ボタンデザイン HOVERで上に着いたラベルが広がって背景になる

CSS HTML
 2018.03.17

HOVERで上に着いたラベルが広がって背景になる

HOVERで上に着いたラベルが広がって背景になるボタンです。

browser:  65 11 20 11 
ニャン易度 
<button class="cp_button04">button</button>
.cp_button04 {
	display: inline-block;
	padding: 1em;
	width: 160px;
	background: transparent;
	cursor: pointer;
	line-height: 1.4;
	user-select: none;
	vertical-align: bottom;
	transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
	color: #F4511E;
	border: 1px solid #F4511E;
	border-radius: 0;
	position: relative;
	z-index: 1;
}
.cp_button04:hover:before {
	-webkit-transform: scale(0.85, 1) translate(8%, -15%);
	        transform: scale(0.85, 1) translate(8%, -15%);
}
.cp_button04:active:before {
	transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
	transition-duration: 0.15s;
	-webkit-transform: scale(1, 1.2) translate(6%, 3%);
	        transform: scale(1, 1.2) translate(6%, 3%);
}
.cp_button04:before {
	position: absolute;
	z-index: -1;
	top: 0;
	left: 0;
	display: block;
	width: 100%;
	height: 100%;
	content: '';
	transition: transform 0.3s, background-color 0.3s;
	-webkit-transform: scale(0.3, 0.2) translate(12%, -20%);
	        transform: scale(0.3, 0.2) translate(12%, -20%);
	transform-origin: 5% -5%;
	background-color: #ff7043;
}
.cp_button04:hover,
.cp_button04:active {
	color: #ffffff;
	border: 1px solid #ff7043;
}
.cp_button04:focus {
	color: #ff7043;
	border: 1px solid #ff7043;
}
.cp_button04:focus:hover {
	color: #ffffff;
	border: 1px solid #ff7043;
}
.cp_button04:focus:before {
	background-color: #ff7043;
}

copypet.jp

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

More Info

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