255 views
CSSAdd prefixes
1.button { 2 position: absolute; 3 top: 50%; 4 left: 50%; 5 transform: translate(-50%, -50%); 6 display: flex; 7 border-radius: 9999px; 8 border: none; 9 height: 50px; 10 cursor: pointer; 11 background-color: inherit; 12} 13 14.button span { 15 line-height: 50px; 16 padding: 0 20px; 17 padding-right: 60px; 18 font-size: 20px; 19 font-weight: 600; 20 color: #000; 21} 22 23.button .background { 24 width: 50px; 25 height: 50px; 26 position: absolute; 27 top: 0px; 28 right: 0px; 29 border-radius: 9999px; 30 background-color: rgb(84, 238, 92); 31 transition: width .2s ease-in-out; 32 z-index: -1; 33} 34 35.button .background svg { 36 width: 36px; 37 height: 36px; 38 position: absolute; 39 top: 50%; 40 right: -1px; 41 transform: translate(0%, -50%); 42} 43 44.button:hover .background { 45 width: 100%; 46}
HTML
1<button class="button"> 2 <span>Subscribe</span> 3 <div class="background"> 4 <svg width="36px" height="36px" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" stroke-width="3" stroke="#000000" fill="none"><circle cx="29.22" cy="16.28" r="11.14"></circle><path d="M41.32,35.69c-2.69-1.95-8.34-3.25-12.1-3.25h0A22.55,22.55,0,0,0,6.67,55h29.9"></path><circle cx="45.38" cy="46.92" r="11.94"></circle><line x1="45.98" y1="39.8" x2="45.98" y2="53.8"></line><line x1="38.98" y1="46.8" x2="52.98" y2="46.8"></line></svg> 5 </div> 6</button>