147 views
CSSAdd prefixes
1.button { 2 position: relative; 3 width: 150px; 4 height: 40px; 5 cursor: pointer; 6 display: flex; 7 align-items: center; 8 border: 1px solid #17795E; 9 background-color: #209978; 10 overflow: hidden; 11} 12 13.button, .button__icon, .button__text { 14 transition: all 0.3s; 15} 16 17.button .button__text { 18 transform: translateX(22px); 19 color: #fff; 20 font-weight: 600; 21} 22 23.button .button__icon { 24 position: absolute; 25 transform: translateX(109px); 26 height: 100%; 27 width: 39px; 28 background-color: #17795E; 29 display: flex; 30 align-items: center; 31 justify-content: center; 32} 33 34.button .svg { 35 width: 20px; 36 fill: #fff; 37} 38 39.button:hover { 40 background: #17795E; 41} 42 43.button:hover .button__text { 44 color: transparent; 45} 46 47.button:hover .button__icon { 48 width: 148px; 49 transform: translateX(0); 50} 51 52.button:active .button__icon { 53 background-color: #146c54; 54} 55 56.button:active { 57 border: 1px solid #146c54; 58}
HTML
1<button class="button" type="button"> 2 <span class="button__text">Download</span> 3 <span class="button__icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 35" id="bdd05811-e15d-428c-bb53-8661459f9307" data-name="Layer 2" class="svg"><path d="M17.5,22.131a1.249,1.249,0,0,1-1.25-1.25V2.187a1.25,1.25,0,0,1,2.5,0V20.881A1.25,1.25,0,0,1,17.5,22.131Z"></path><path d="M17.5,22.693a3.189,3.189,0,0,1-2.262-.936L8.487,15.006a1.249,1.249,0,0,1,1.767-1.767l6.751,6.751a.7.7,0,0,0,.99,0l6.751-6.751a1.25,1.25,0,0,1,1.768,1.767l-6.752,6.751A3.191,3.191,0,0,1,17.5,22.693Z"></path><path d="M31.436,34.063H3.564A3.318,3.318,0,0,1,.25,30.749V22.011a1.25,1.25,0,0,1,2.5,0v8.738a.815.815,0,0,0,.814.814H31.436a.815.815,0,0,0,.814-.814V22.011a1.25,1.25,0,1,1,2.5,0v8.738A3.318,3.318,0,0,1,31.436,34.063Z"></path></svg></span> 4</button>