.container { display: flex; justify-content: center; margin-top: 30px; } .card { position: relative; width: 230px; height: 260px; margin: 0 5px; background-color: red; transition: 0.3s; overflow: hidden; cursor: pointer; } .card img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; } .card::after { content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; opacity: 0; transition: 0.3s; background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1)); } .content { position: absolute; bottom: 0; width: 100%; padding: 1rem; z-index: 1; color: #fff; transition: 0.3s; opacity: 0; } .btn { padding: 0.3rem 0.8rem; font-size: 0.6rem; border: none; cursor: pointer; outline: none; color: #fff; background: transparent; border: 2px solid #fff; } .content p { font-size: 0.6rem; margin: 0.5rem 0; } .card:hover { width: 350px; } .card:hover img { transform: scale(1.1); } .card:hover:after, .card:hover .content { opacity: 1; }