.card-mod { display: inline-block; float: none; margin: 5px; position: relative; height: 340px; min-width: 220px; overflow-y: auto; } .card .overlay { position: absolute; top: 0; bottom: 0; left: 0; right: 0; max-height: 100%; max-width: 100%; opacity: 0; transition: .5s ease; background-color: #343a40c5; font-size: 1rem; color: white; } .card img { max-height: 100%; height: 100%; } .card:hover .overlay { opacity: 1; }