[装飾系]ボタンデザイン HOVERで内側から枠が出る

CSS HTML
 2018.03.17

HOVERで内側から枠が出る

HOVERで内側から枠が出るボタンです。

browser:  65 11 20 11 
ニャン易度 
<button class="cp_button12">button</button>
.cp_button12 {
	width: 160px;
	margin: 0.4em;
	padding: 1em;
	line-height: 1.4;
	cursor: pointer;
	user-select: none;
	-webkit-transform: translateZ(0);
	        transform: translateZ(0);
	color: #ffffff;
	border: 1px solid #29b6f6;
	background: #29b6f6;
	box-shadow: 0 0 1px rgba(0, 0, 0, 0);
}
.cp_button12:before {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	content: '';
	-webkit-transition-duration: 0.3s;
	        transition-duration: 0.3s;
	-webkit-transition-property: top right bottom left;
	        transition-property: top right bottom left;
	border: rgba(41,182,246,0.5) solid 4px;
}
.cp_button12:hover:before {
	top: -8px;
	right: -8px;
	bottom: -8px;
	left: -8px;
	opacity: 1;
}
.cp_button12:active {
	color: #ffffff;
	background-color: #0288d1;
}
.cp_button12:active:before {
	top: -3px;
	right: -3px;
	bottom: -3px;
	left: -3px;
}
.cp_button12:focus:hover,
.cp_button12:focus,
.cp_button12:active:hover,
.cp_button12:hover {
	color: #ffffff;
	border: 1px solid #29b6f6;
}

copypet.jp

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

More Info

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