Cards
Cuatro cards con animaciones al pasar el mouse, hechas solo con HTML y CSS.
Pantalla completa — se abre en una pestaña nueva
Código
HTML
<section class="w-100"><div class="cards-container">
<div class="row justify-content-center">
<div class="single-card-wraper col-6 py-5">
<div class="card-1">
<div class="content">
<h2>design</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, incididunt ut labore et, incididunt ut labore et.</p>
<a href="#">read more</a>
</div>
</div>
</div>
<div class="single-card-wraper col-6 py-5">
<div class="card-3">
<div class="imgbox">
<img src="/wp-content/themes/jme/assets/img/lab/card-retrato.svg" />
</div>
<div class="details">
<h2>
Peter Parker<br />
<span>Fotografo</span>
</h2>
</div>
</div>
</div>
<div class="single-card-wraper col-6 py-5">
<div class="card-2">
<div class="content">
<h2>Magneto</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<a href="#">read more</a>
</div>
<img src="/wp-content/themes/jme/assets/img/lab/card-emblema.svg" />
</div>
</div>
<div class="single-card-wraper col-6 py-5">
<div class="card-4">
<div class="imgbox">
<img src="/wp-content/themes/jme/assets/img/lab/card-plato.svg" />
</div>
<div class="content">
<h3>post title</h3>
<p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<a href="#">read more</a>
</div>
</div>
</div>
</div>
</div></section>
CSS
section{
background-color: #e2e2e2;
position: relative;
z-index:1;
padding: 50px 0;
}
.cards-container{
max-width: 90%;
margin: 0 auto;
}
.cards-container .single-card-wraper {
display: flex;
align-items: center;
justify-content: center;
}
/* card-1 */
.card-1 {
position: relative;
width: 320px;
padding: 40px;
background-color: white;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.card-1:before {
content: "";
position: absolute;
left: 0;
bottom: calc(-100% + 5px);
width: 100%;
height: 100%;
background-color: #ff56ac;
z-index: 1;
transition: 0.5s;
}
.card-1:hover:before {
bottom: 0;
}
.content {
position: relative;
text-transform: capitalize;
color: #777;
z-index: 2;
transition: 0.5s;
}
.card-1 h2 {
margin-bottom: 10px;
margin-top: 0;
font-size: 30px;
}
.card-1 p {
font-size: 18px;
}
.card-1 a {
margin-top: 10px;
font-size: 14px;
display: inline-block;
text-decoration: none;
color: #777;
padding: 6px 10px;
font-weight: 600;
background-color: white;
box-shadow: 0 2px 20px rgba(0,0,0,0.05);
}
.card-1:hover .content {
color: white;
}
/* card-2 */
.card-2 {
position: relative;
width: 500px;
height: 300px;
display: flex;
align-items: center;
background: linear-gradient(45deg, #d41e31, #491f8f);
border-radius: 20px;
}
.card-2 img {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
height: 400px;
transition: 0.5s;
}
.card-2:hover img {
height: 450px;
left: 80%;
}
.card-2 .content {
position: relative;
width: 40%;
left: 20%;
color: white;
text-transform: capitalize;
transition: 0.5s;
opacity: 0;
}
.card-2:hover .content {
left: 5%;
opacity: 1;
}
.card-2 h2 {
margin: 0;
padding: 0;
}
.card-2 p {
margin-bottom: 20px;
}
.card-2 a {
position: relative;
display: inline-block;
color: #111;
padding: 5px 10px;
background: white;
text-decoration: none;
border-radius: 10px;
}
/* card-3 */
.card-3 {
position: relative;
width: 320px;
height: 350px;
background: white;
border-radius: 4px;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.card-3:before,
.card-3:after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 4px;
background-color: white;
transition: 0.5s;
z-index: -1;
}
.card-3:hover:before {
transform: rotate(20deg);
box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.card-3:hover:after {
transform: rotate(10deg);
box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.card-3 .imgbox {
position: absolute;
top: 10px;
left: 10px;
bottom: 10px;
right: 10px;
background-color: #222;
transition: 0.5s;
z-index: 2;
}
.card-3:hover .imgbox {
bottom: 80px;
}
.card-3 .details {
position: absolute;
left: 10px;
right: 10px;
bottom: 10px;
height: 60px;
text-align: center;
}
.card-3 h2 {
margin: 0;
padding: 0;
font-weight: 600;
font-size: 20px;
color: #777;
text-transform: uppercase;
}
.card-3 h2 span {
font-weight: 500;
font-size: 16px;
color: #f38695;
}
.card-3 img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
/* card-4 */
.card-4 {
position: relative;
width: 300px;
height: 400px;
background-color: black;
box-shadow: 0px 30px 30px rgba(0,0,0,0.5);
}
.card-4 .content {
position: absolute;
bottom: 0px;
width: 80%;
height: 80px;
background-color: white;
left: 10%;
text-align: center;
transition: 0.5s;
overflow: hidden;
}
.card-4 h3 {
font-size: 30px;
text-transform: uppercase;
margin: 25px;
}
.card-4 p {
width: 80%;
margin: 10px auto;
font-size: 18px;
transition: 0.5s;
opacity: 0;
}
.card-4 a {
text-decoration: none;
background-color: black;
color: white;
padding: 10px 15px;
display: inline-block;
margin-top: 10px;
transition: 0.5s;
opacity: 0;
}
.card-4:hover .content {
height: 100%;
width: 100%;
left: 0%;
}
.card-4:hover p,
.card-4:hover a {
opacity: 1;
transition-delay: 0.5s;
}
.card-4 .imgbox {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: 0.5s;
}
.card-4 img {
width: 100%;
height: 100%;
object-fit: cover;
transition: 0.5s;
}
.card-4:hover img {
opacity: 0;
}
/* --- Mobile (2026-10-08) --- */
/* Bootstrap's col-6 keeps two columns at every width, which squeezed each
card to a word per line: below a laptop the cards stack one per row,
and none is wider than the screen. */
@media (max-width: 991.98px) {
.cards-container .single-card-wraper {
width: 100%;
}
}
@media (max-width: 575.98px) {
.cards-container { max-width: 100%; padding: 0 16px; }
.card-1,
.card-2,
.card-3,
.card-4 { max-width: 100%; }
.card-2 { height: 260px; }
.card-2 img { height: 300px; }
.card-2 .content { width: 55%; }
}
/* A touch screen has no hover: the two cards that hide their text until
then show it from the start, in their hovered layout. */
@media (hover: none) {
.card-2 .content { left: 5%; opacity: 1; }
.card-2 img { left: 78%; }
.card-4 .content { height: 100%; width: 100%; left: 0; }
.card-4 p,
.card-4 a { opacity: 1; }
.card-4 img { opacity: 0.25; }
}