CSSAdd prefixes
1button { 2 position: relative; 3 background: #6a92ef; 4 color: white; 5 padding: .9rem 2.20rem; 6 border-radius: 2rem; 7 transition: .5s; 8 border: none; 9} 10 11button::after { 12 content: ''; 13 width: 80%; 14 height: 40%; 15 background: linear-gradient(80deg, hsl(217, 77%, 71%) 10%, hsl(218, 76%, 84%) 48%); 16 position: absolute; 17 left: 0; 18 right: 0; 19 bottom: -5px; 20 margin: 0 auto; 21 border-radius: 2rem; 22 filter: blur(8px); 23 z-index: -9; 24 opacity: 0; 25 transition: opacity .4s; 26} 27 28.text { 29 position: relative; 30 z-index: 10; 31} 32 33button svg { 34 position: absolute; 35 inset: 0; 36 margin: auto; 37 pointer-events: none; 38 transition: .6s; 39 opacity: 0; 40} 41 42svg.star { 43 width: 18px; 44 transform: translate(-25px, -6px) rotate(55deg); 45 filter: blur(.4px); 46 color: hsl(210, 40%, 47%); 47} 48 49svg.moon { 50 width: 18px; 51 transform: translate(7px, -14) rotate(80deg); 52 filter: blur(.5px); 53 color: hsl(210, 40%, 47%); 54} 55 56svg.meteor { 57 width: 16px; 58 transform: translate(34px, -4px) rotate(-45deg); 59 filter: blur(.4px); 60 color: hsl(210, 40%, 47%); 61} 62 63button:active { 64 color: #ffffff; 65 transform: scale(1.2); 66} 67 68button:hover::after { 69 opacity: 1; 70} 71 72button:hover { 73 transform: scale(1.3); 74} 75 76button:hover svg { 77 opacity: 1; 78} 79 80button:hover svg.star { 81 transform: translate(-55px, -20px) rotate(55deg) scale(1.8); 82} 83 84button:hover svg.moon { 85 transform: translate(50px, -32px) rotate(0deg) scale(1.4); 86} 87 88button:hover svg.meteor { 89 transform: translate(28px, 30px) rotate(260deg) scale(2); 90}
HTML
1<button> 2 <span class="text"> 3 Hover Me! 4 </span> 5 <svg viewBox="0 0 576 512" xmlns="http://www.w3.org/2000/svg" class="star"><path fill="currentcolor" d="M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z"></path></svg> 6 <svg viewBox="0 0 384 512" xmlns="http://www.w3.org/2000/svg" class="moon"><path fill="currentcolor" d="M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z"></path></svg> 7 <svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" class="meteor"><path fill="currentcolor" d="M493.7 .9L299.4 75.6l2.3-29.3c1-12.8-12.8-21.5-24-15.1L101.3 133.4C38.6 169.7 0 236.6 0 309C0 421.1 90.9 512 203 512c72.4 0 139.4-38.6 175.7-101.3L480.8 234.3c6.5-11.1-2.2-25-15.1-24l-29.3 2.3L511.1 18.3c.6-1.5 .9-3.2 .9-4.8C512 6 506 0 498.5 0c-1.7 0-3.3 .3-4.8 .9zM192 192a128 128 0 1 1 0 256 128 128 0 1 1 0-256zm0 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm16 96a16 16 0 1 0 0-32 16 16 0 1 0 0 32z"></path></svg> 8</button>
