17K views
CSSAdd prefixes
1.card { 2 width: 190px; 3 height: 254px; 4 padding: .8em; 5 background: #f5f5f5; 6 position: relative; 7 overflow: visible; 8 box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); 9} 10 11.card-img { 12 background-color: #ffcaa6; 13 height: 40%; 14 width: 100%; 15 border-radius: .5rem; 16 transition: .3s ease; 17} 18 19.card-info { 20 padding-top: 10%; 21} 22 23svg { 24 width: 20px; 25 height: 20px; 26} 27 28.card-footer { 29 width: 100%; 30 display: flex; 31 justify-content: space-between; 32 align-items: center; 33 padding-top: 10px; 34 border-top: 1px solid #ddd; 35} 36 37/*Text*/ 38.text-title { 39 font-weight: 900; 40 font-size: 1.2em; 41 line-height: 1.5; 42} 43 44.text-body { 45 font-size: .9em; 46 padding-bottom: 10px; 47} 48 49/*Button*/ 50.card-button { 51 border: 1px solid #252525; 52 display: flex; 53 padding: .3em; 54 cursor: pointer; 55 border-radius: 50px; 56 transition: .3s ease-in-out; 57} 58 59/*Hover*/ 60.card-img:hover { 61 transform: translateY(-25%); 62 box-shadow: rgba(226, 196, 63, 0.25) 0px 13px 47px -5px, rgba(180, 71, 71, 0.3) 0px 8px 16px -8px; 63} 64 65.card-button:hover { 66 border: 1px solid #ffcaa6; 67 background-color: #ffcaa6; 68} 69
HTML
1 <div class="card"> 2 <div class="card-img"></div> 3 <div class="card-info"> 4 <p class="text-title">Product title </p> 5 <p class="text-body">Product description and details</p> 6 </div> 7 <div class="card-footer"> 8 <span class="text-title">$499.49</span> 9 <div class="card-button"> 10 <svg class="svg-icon" viewBox="0 0 20 20"> 11 <path d="M17.72,5.011H8.026c-0.271,0-0.49,0.219-0.49,0.489c0,0.271,0.219,0.489,0.49,0.489h8.962l-1.979,4.773H6.763L4.935,5.343C4.926,5.316,4.897,5.309,4.884,5.286c-0.011-0.024,0-0.051-0.017-0.074C4.833,5.166,4.025,4.081,2.33,3.908C2.068,3.883,1.822,4.075,1.795,4.344C1.767,4.612,1.962,4.853,2.231,4.88c1.143,0.118,1.703,0.738,1.808,0.866l1.91,5.661c0.066,0.199,0.252,0.333,0.463,0.333h8.924c0.116,0,0.22-0.053,0.308-0.128c0.027-0.023,0.042-0.048,0.063-0.076c0.026-0.034,0.063-0.058,0.08-0.099l2.384-5.75c0.062-0.151,0.046-0.323-0.045-0.458C18.036,5.092,17.883,5.011,17.72,5.011z"></path> 12 <path d="M8.251,12.386c-1.023,0-1.856,0.834-1.856,1.856s0.833,1.853,1.856,1.853c1.021,0,1.853-0.83,1.853-1.853S9.273,12.386,8.251,12.386z M8.251,15.116c-0.484,0-0.877-0.393-0.877-0.874c0-0.484,0.394-0.878,0.877-0.878c0.482,0,0.875,0.394,0.875,0.878C9.126,14.724,8.733,15.116,8.251,15.116z"></path> 13 <path d="M13.972,12.386c-1.022,0-1.855,0.834-1.855,1.856s0.833,1.853,1.855,1.853s1.854-0.83,1.854-1.853S14.994,12.386,13.972,12.386z M13.972,15.116c-0.484,0-0.878-0.393-0.878-0.874c0-0.484,0.394-0.878,0.878-0.878c0.482,0,0.875,0.394,0.875,0.878C14.847,14.724,14.454,15.116,13.972,15.116z"></path> 14 </svg> 15 </div> 16</div></div>