【CSS】マウスホバー時に『キラーん』と光るような効果のボタン作成メモ
目次
サンプル
マウスが重なると光るようなアニメーションが表示されます。
ボタン
HTML
< a href = "#" class = "btn" >ボタン</ a > |
CSS
.btn { display : flex; justify- content : center ; align-items: center ; background-color : #bdfa3e ; width : 28.4 rem; height : 11 rem; border-radius: 5.5 rem; font-size : 3.8 rem; font-weight : 900 ; box-shadow: 0 1 rem 1 rem rgba( 0 , 0 , 0 ,. 16 ); overflow : hidden ; position : relative ; text-decoration : none ; } .btn::before { content : '' ; display : block ; width : 5 rem; height : 300% ; top : 50% ; position : absolute ; background-color : #fff ; transform: translate( -500% , -50% ) rotate( -45 deg); transition: transform . 5 s ease; } .btn:hover::before { transform: translate( 500% , -50% ) rotate( -45 deg); } |
その他参考サイト