[装飾系]ボタンデザイン HOVERで横にぷるんと動く

CSS HTML
 2018.03.17

HOVERで横にぷるんと動く

HOVERで横にぷるんと動くボタンです。

browser:  65 11 20 11 
ニャン易度 
<button class="cp_button14">button</button>
.cp_button14 {
	display: inline-block;
	width: 160px;
	padding: 1em;
	line-height: 1.4;
	cursor: pointer;
	user-select: none;
	transition: transform 0.2s, background-color 0.2s;
	-webkit-transform: translateZ(0);
	        transform: translateZ(0);
	color: #283593;
	border: 0;
	border-radius: 50px;
	background: #26c6da;
	box-shadow: 0 0 1px rgba(0, 0, 0, 0);
}
.cp_button14:hover {
	-webkit-animation: button14 1s ease-in-out;
	        animation: button14 1s ease-in-out;
	color: #283593;
}
.cp_button14:active {
	-webkit-transform: translate(2px, 2px);
	        transform: translate(2px, 2px);
	background-color: #00acc1;
}
.cp_button13:focus {
	color: #283593;
}
@-webkit-keyframes button14 {
	16.65% {
		-webkit-transform: translateX(8px);
		        transform: translateX(8px);
	}
	33.3% {
		-webkit-transform: translateX(-6px);
		        transform: translateX(-6px);
	}
	49.95% {
		-webkit-transform: translateX(4px);
		        transform: translateX(4px);
	}
	66.6% {
		-webkit-transform: translateX(-2px);
		        transform: translateX(-2px);
	}
	83.25% {
		-webkit-transform: translateX(1px);
		        transform: translateX(1px);
	}
	100% {
		-webkit-transform: translateX(0);
		        transform: translateX(0);
	}
}
@keyframes button14 {
	16.65% {
		-webkit-transform: translateX(8px);
		        transform: translateX(8px);
	}
	33.3% {
		-webkit-transform: translateX(-6px);
		        transform: translateX(-6px);
	}
	49.95% {
		-webkit-transform: translateX(4px);
		        transform: translateX(4px);
	}
	66.6% {
		-webkit-transform: translateX(-2px);
		        transform: translateX(-2px);
	}
	83.25% {
		-webkit-transform: translateX(1px);
		        transform: translateX(1px);
	}
	100% {
		-webkit-transform: translateX(0);
		        transform: translateX(0);
	}
}

copypet.jp

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

More Info

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