如何在悬停 div 时应用背景效果而不覆盖背景
How to Apply a background effect on hover div without ovewriting the background
我正在尝试在设置了背景图像的 div 和 link 和 div 上应用线性渐变层,其中包含一些子内容。
我部分理解了。但是有一些不受欢迎的行为。您可以在 JSFiddle
中查看源代码
.IB-container {
width: 100%;
margin: 20px auto;
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-gap: 0.5rem;
grid-template-areas:
"IB-area-1 IB-area-1 IB-area-2 IB-area-2 IB-area-2 IB-area-2"
"IB-area-1 IB-area-1 IB-area-3 IB-area-3 IB-area-4 IB-area-4";
}
.IB-container > * {
/* border-radius: 8px; */
display: flex;
align-items: center;
justify-content: center;
}
.IB-container .IB-area-1 {
grid-area: IB-area-1;
overflow: hidden;
}
.IB-container .IB-area-2 {
grid-area: IB-area-2;
overflow: hidden;
}
.IB-container .IB-area-3 {
grid-area: IB-area-3;
overflow: hidden;
}
.IB-container .IB-area-4 {
grid-area: IB-area-4;
overflow: hidden;
}
.IB-container .IB-image-link {
height: 100%;
width: 100%;
position: relative;
}
.IB-contenido {
position: relative;
height: 100%;
}
.IB-contenido .IB-imagen-1 {
min-height: calc(100vh - 100px);
background-image: url("https://images.pexels.com/photos/775687/pexels-photo-775687.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-2 {
background-image: url("https://images.pexels.com/photos/1144176/pexels-photo-1144176.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-3 {
background-image: url("https://images.pexels.com/photos/697313/pexels-photo-697313.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-4 {
background-image: url("https://images.pexels.com/photos/785405/pexels-photo-785405.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-1,
.IB-contenido .IB-imagen-2,
.IB-contenido .IB-imagen-3,
.IB-contenido .IB-imagen-4 {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 100%;
}
.IB-contenido .IB-texto {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.IB-container .IB-h2 {
position: relative;
font-family: "Poiret One", cursive;
text-transform: uppercase;
color: white;
text-align: center;
font-size: 40px;
font-weight: 700;
}
.IB-mb-3 {
margin-bottom: 2rem;
}
.IB-text-button {
position: relative;
text-decoration: none;
text-align: center;
cursor: pointer;
-webkit-appearance: none;
text-transform: uppercase;
background: none;
white-space: normal;
}
.IB-btn-small {
display: inline-block;
font-size: 12px;
letter-spacing: 3px;
}
.IB-btn-line {
color: #fff;
transition: all 0.25s ease-in;
border: 1px solid;
padding: 8px 20px 8px 24px;
line-height: 18px;
}
div[class^="IB-area-"]:hover .IB-imagen {
transition: all 0.8s ease;
transform: scale(1.08);
}
.IB-imagen:hover:before {
background: linear-gradient(to top, #000, transparent);
position: absolute;
content: "";
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
opacity: 0.4;
}
.IB-text-button:hover {
color: #acb1b7;
background-color: #ffffff;
}
@media screen and (max-width: 768px) {
.IB-container {
grid-template-areas:
"IB-area-1 IB-area-1 IB-area-1 IB-area-1 IB-area-1 IB-area-1"
"IB-area-2 IB-area-2 IB-area-2 IB-area-2 IB-area-2 IB-area-2"
"IB-area-3 IB-area-3 IB-area-3 IB-area-3 IB-area-3 IB-area-3"
"IB-area-4 IB-area-4 IB-area-4 IB-area-4 IB-area-4 IB-area-4";
}
.IB-container .IB-imagen-1,
.IB-container .IB-imagen-2,
.IB-container .IB-imagen-3,
.IB-container .IB-imagen-4 {
min-height: 250px;
max-height: 250px;
}
}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
href="https://fonts.googleapis.com/css2?family=Poiret+One&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div class="IB-container">
<div class="IB-area-1">
<a
class="IB-image-link"
href="https://google.com"
title="titulo1"
aria-label="titulo1"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-1"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">titulo 1</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
<div class="IB-area-2">
<a
class="IB-image-link"
href="https://google.com"
title="titulo2"
aria-label="titulo2"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-2"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">titulo 2</div>
<div class="IB-text-button IB-btn-small IB-btn-line">Ver Mas</div>
</div>
</div>
</a>
</div>
<div class="IB-area-3">
<a
class="IB-image-link"
href="https://google.com"
title="titulo3"
aria-label="TITULO3"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-3"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">Titulo 3</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
<div class="IB-area-4">
<a
class="IB-image-link"
href="https://google.com"
title="titulo4"
aria-label="titulo4"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-4"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">Titulo 4</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
</div>
</body>
</html>
问题
当我指向父 div (IB-area-N
) 时,悬停伪 class 工作正常并执行适当的样式更改,但是当指针越过子 div (IB-texto) 效果消失。
我发现缺陷在这两个选择器之间。
div[class^="IB-area-"]:hover .IB-imagen {
transition: all 0.8s ease;
transform: scale(1.08);
}
.IB-imagen:hover:before {
background: linear-gradient(to top, #000, transparent);
position: absolute;
content: "";
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
opacity: 0.4;
}
为什么不简单地将渐变与缩放变换一起放在第一个选择器中?...
好吧,并非一切都那么简单,当我尝试时背景图像被覆盖了:S
谁能给我一些关于这些令人不安的选择器的情况的说明?
非常感谢
只需将此 .IB-imagen:hover:before
更新为 div[class^="IB-area-"]:hover .IB-imagen::before
.IB-container {
width: 100%;
margin: 20px auto;
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-gap: 0.5rem;
grid-template-areas:
"IB-area-1 IB-area-1 IB-area-2 IB-area-2 IB-area-2 IB-area-2"
"IB-area-1 IB-area-1 IB-area-3 IB-area-3 IB-area-4 IB-area-4";
}
.IB-container > * {
/* border-radius: 8px; */
display: flex;
align-items: center;
justify-content: center;
}
.IB-container .IB-area-1 {
grid-area: IB-area-1;
overflow: hidden;
}
.IB-container .IB-area-2 {
grid-area: IB-area-2;
overflow: hidden;
}
.IB-container .IB-area-3 {
grid-area: IB-area-3;
overflow: hidden;
}
.IB-container .IB-area-4 {
grid-area: IB-area-4;
overflow: hidden;
}
.IB-container .IB-image-link {
height: 100%;
width: 100%;
position: relative;
}
.IB-contenido {
position: relative;
height: 100%;
}
.IB-contenido .IB-imagen-1 {
min-height: calc(100vh - 100px);
background-image: url("https://images.pexels.com/photos/775687/pexels-photo-775687.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-2 {
background-image: url("https://images.pexels.com/photos/1144176/pexels-photo-1144176.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-3 {
background-image: url("https://images.pexels.com/photos/697313/pexels-photo-697313.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-4 {
background-image: url("https://images.pexels.com/photos/785405/pexels-photo-785405.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-1,
.IB-contenido .IB-imagen-2,
.IB-contenido .IB-imagen-3,
.IB-contenido .IB-imagen-4 {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 100%;
}
.IB-contenido .IB-texto {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.IB-container .IB-h2 {
position: relative;
font-family: "Poiret One", cursive;
text-transform: uppercase;
color: white;
text-align: center;
font-size: 40px;
font-weight: 700;
}
.IB-mb-3 {
margin-bottom: 2rem;
}
.IB-text-button {
position: relative;
text-decoration: none;
text-align: center;
cursor: pointer;
-webkit-appearance: none;
text-transform: uppercase;
background: none;
white-space: normal;
}
.IB-btn-small {
display: inline-block;
font-size: 12px;
letter-spacing: 3px;
}
.IB-btn-line {
color: #fff;
transition: all 0.25s ease-in;
border: 1px solid;
padding: 8px 20px 8px 24px;
line-height: 18px;
}
div[class^="IB-area-"]:hover .IB-imagen {
transition: all 0.8s ease;
transform: scale(1.08);
}
div[class^="IB-area-"]:hover .IB-imagen::before {
background: linear-gradient(to top, #000, transparent);
position: absolute;
content: "";
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
opacity: 0.4;
}
.IB-text-button:hover {
color: #acb1b7;
background-color: #ffffff;
}
@media screen and (max-width: 768px) {
.IB-container {
grid-template-areas:
"IB-area-1 IB-area-1 IB-area-1 IB-area-1 IB-area-1 IB-area-1"
"IB-area-2 IB-area-2 IB-area-2 IB-area-2 IB-area-2 IB-area-2"
"IB-area-3 IB-area-3 IB-area-3 IB-area-3 IB-area-3 IB-area-3"
"IB-area-4 IB-area-4 IB-area-4 IB-area-4 IB-area-4 IB-area-4";
}
.IB-container .IB-imagen-1,
.IB-container .IB-imagen-2,
.IB-container .IB-imagen-3,
.IB-container .IB-imagen-4 {
min-height: 250px;
max-height: 250px;
}
}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
href="https://fonts.googleapis.com/css2?family=Poiret+One&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div class="IB-container">
<div class="IB-area-1">
<a
class="IB-image-link"
href="https://google.com"
title="titulo1"
aria-label="titulo1"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-1"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">titulo 1</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
<div class="IB-area-2">
<a
class="IB-image-link"
href="https://google.com"
title="titulo2"
aria-label="titulo2"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-2"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">titulo 2</div>
<div class="IB-text-button IB-btn-small IB-btn-line">Ver Mas</div>
</div>
</div>
</a>
</div>
<div class="IB-area-3">
<a
class="IB-image-link"
href="https://google.com"
title="titulo3"
aria-label="TITULO3"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-3"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">Titulo 3</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
<div class="IB-area-4">
<a
class="IB-image-link"
href="https://google.com"
title="titulo4"
aria-label="titulo4"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-4"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">Titulo 4</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
</div>
</body>
</html>
我正在尝试在设置了背景图像的 div 和 link 和 div 上应用线性渐变层,其中包含一些子内容。
我部分理解了。但是有一些不受欢迎的行为。您可以在 JSFiddle
中查看源代码.IB-container {
width: 100%;
margin: 20px auto;
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-gap: 0.5rem;
grid-template-areas:
"IB-area-1 IB-area-1 IB-area-2 IB-area-2 IB-area-2 IB-area-2"
"IB-area-1 IB-area-1 IB-area-3 IB-area-3 IB-area-4 IB-area-4";
}
.IB-container > * {
/* border-radius: 8px; */
display: flex;
align-items: center;
justify-content: center;
}
.IB-container .IB-area-1 {
grid-area: IB-area-1;
overflow: hidden;
}
.IB-container .IB-area-2 {
grid-area: IB-area-2;
overflow: hidden;
}
.IB-container .IB-area-3 {
grid-area: IB-area-3;
overflow: hidden;
}
.IB-container .IB-area-4 {
grid-area: IB-area-4;
overflow: hidden;
}
.IB-container .IB-image-link {
height: 100%;
width: 100%;
position: relative;
}
.IB-contenido {
position: relative;
height: 100%;
}
.IB-contenido .IB-imagen-1 {
min-height: calc(100vh - 100px);
background-image: url("https://images.pexels.com/photos/775687/pexels-photo-775687.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-2 {
background-image: url("https://images.pexels.com/photos/1144176/pexels-photo-1144176.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-3 {
background-image: url("https://images.pexels.com/photos/697313/pexels-photo-697313.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-4 {
background-image: url("https://images.pexels.com/photos/785405/pexels-photo-785405.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-1,
.IB-contenido .IB-imagen-2,
.IB-contenido .IB-imagen-3,
.IB-contenido .IB-imagen-4 {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 100%;
}
.IB-contenido .IB-texto {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.IB-container .IB-h2 {
position: relative;
font-family: "Poiret One", cursive;
text-transform: uppercase;
color: white;
text-align: center;
font-size: 40px;
font-weight: 700;
}
.IB-mb-3 {
margin-bottom: 2rem;
}
.IB-text-button {
position: relative;
text-decoration: none;
text-align: center;
cursor: pointer;
-webkit-appearance: none;
text-transform: uppercase;
background: none;
white-space: normal;
}
.IB-btn-small {
display: inline-block;
font-size: 12px;
letter-spacing: 3px;
}
.IB-btn-line {
color: #fff;
transition: all 0.25s ease-in;
border: 1px solid;
padding: 8px 20px 8px 24px;
line-height: 18px;
}
div[class^="IB-area-"]:hover .IB-imagen {
transition: all 0.8s ease;
transform: scale(1.08);
}
.IB-imagen:hover:before {
background: linear-gradient(to top, #000, transparent);
position: absolute;
content: "";
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
opacity: 0.4;
}
.IB-text-button:hover {
color: #acb1b7;
background-color: #ffffff;
}
@media screen and (max-width: 768px) {
.IB-container {
grid-template-areas:
"IB-area-1 IB-area-1 IB-area-1 IB-area-1 IB-area-1 IB-area-1"
"IB-area-2 IB-area-2 IB-area-2 IB-area-2 IB-area-2 IB-area-2"
"IB-area-3 IB-area-3 IB-area-3 IB-area-3 IB-area-3 IB-area-3"
"IB-area-4 IB-area-4 IB-area-4 IB-area-4 IB-area-4 IB-area-4";
}
.IB-container .IB-imagen-1,
.IB-container .IB-imagen-2,
.IB-container .IB-imagen-3,
.IB-container .IB-imagen-4 {
min-height: 250px;
max-height: 250px;
}
}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
href="https://fonts.googleapis.com/css2?family=Poiret+One&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div class="IB-container">
<div class="IB-area-1">
<a
class="IB-image-link"
href="https://google.com"
title="titulo1"
aria-label="titulo1"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-1"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">titulo 1</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
<div class="IB-area-2">
<a
class="IB-image-link"
href="https://google.com"
title="titulo2"
aria-label="titulo2"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-2"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">titulo 2</div>
<div class="IB-text-button IB-btn-small IB-btn-line">Ver Mas</div>
</div>
</div>
</a>
</div>
<div class="IB-area-3">
<a
class="IB-image-link"
href="https://google.com"
title="titulo3"
aria-label="TITULO3"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-3"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">Titulo 3</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
<div class="IB-area-4">
<a
class="IB-image-link"
href="https://google.com"
title="titulo4"
aria-label="titulo4"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-4"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">Titulo 4</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
</div>
</body>
</html>
问题
当我指向父 div (IB-area-N
) 时,悬停伪 class 工作正常并执行适当的样式更改,但是当指针越过子 div (IB-texto) 效果消失。
我发现缺陷在这两个选择器之间。
div[class^="IB-area-"]:hover .IB-imagen {
transition: all 0.8s ease;
transform: scale(1.08);
}
.IB-imagen:hover:before {
background: linear-gradient(to top, #000, transparent);
position: absolute;
content: "";
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
opacity: 0.4;
}
为什么不简单地将渐变与缩放变换一起放在第一个选择器中?... 好吧,并非一切都那么简单,当我尝试时背景图像被覆盖了:S
谁能给我一些关于这些令人不安的选择器的情况的说明?
非常感谢
只需将此 .IB-imagen:hover:before
更新为 div[class^="IB-area-"]:hover .IB-imagen::before
.IB-container {
width: 100%;
margin: 20px auto;
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-gap: 0.5rem;
grid-template-areas:
"IB-area-1 IB-area-1 IB-area-2 IB-area-2 IB-area-2 IB-area-2"
"IB-area-1 IB-area-1 IB-area-3 IB-area-3 IB-area-4 IB-area-4";
}
.IB-container > * {
/* border-radius: 8px; */
display: flex;
align-items: center;
justify-content: center;
}
.IB-container .IB-area-1 {
grid-area: IB-area-1;
overflow: hidden;
}
.IB-container .IB-area-2 {
grid-area: IB-area-2;
overflow: hidden;
}
.IB-container .IB-area-3 {
grid-area: IB-area-3;
overflow: hidden;
}
.IB-container .IB-area-4 {
grid-area: IB-area-4;
overflow: hidden;
}
.IB-container .IB-image-link {
height: 100%;
width: 100%;
position: relative;
}
.IB-contenido {
position: relative;
height: 100%;
}
.IB-contenido .IB-imagen-1 {
min-height: calc(100vh - 100px);
background-image: url("https://images.pexels.com/photos/775687/pexels-photo-775687.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-2 {
background-image: url("https://images.pexels.com/photos/1144176/pexels-photo-1144176.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-3 {
background-image: url("https://images.pexels.com/photos/697313/pexels-photo-697313.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-4 {
background-image: url("https://images.pexels.com/photos/785405/pexels-photo-785405.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940");
}
.IB-contenido .IB-imagen-1,
.IB-contenido .IB-imagen-2,
.IB-contenido .IB-imagen-3,
.IB-contenido .IB-imagen-4 {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 100%;
}
.IB-contenido .IB-texto {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.IB-container .IB-h2 {
position: relative;
font-family: "Poiret One", cursive;
text-transform: uppercase;
color: white;
text-align: center;
font-size: 40px;
font-weight: 700;
}
.IB-mb-3 {
margin-bottom: 2rem;
}
.IB-text-button {
position: relative;
text-decoration: none;
text-align: center;
cursor: pointer;
-webkit-appearance: none;
text-transform: uppercase;
background: none;
white-space: normal;
}
.IB-btn-small {
display: inline-block;
font-size: 12px;
letter-spacing: 3px;
}
.IB-btn-line {
color: #fff;
transition: all 0.25s ease-in;
border: 1px solid;
padding: 8px 20px 8px 24px;
line-height: 18px;
}
div[class^="IB-area-"]:hover .IB-imagen {
transition: all 0.8s ease;
transform: scale(1.08);
}
div[class^="IB-area-"]:hover .IB-imagen::before {
background: linear-gradient(to top, #000, transparent);
position: absolute;
content: "";
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
opacity: 0.4;
}
.IB-text-button:hover {
color: #acb1b7;
background-color: #ffffff;
}
@media screen and (max-width: 768px) {
.IB-container {
grid-template-areas:
"IB-area-1 IB-area-1 IB-area-1 IB-area-1 IB-area-1 IB-area-1"
"IB-area-2 IB-area-2 IB-area-2 IB-area-2 IB-area-2 IB-area-2"
"IB-area-3 IB-area-3 IB-area-3 IB-area-3 IB-area-3 IB-area-3"
"IB-area-4 IB-area-4 IB-area-4 IB-area-4 IB-area-4 IB-area-4";
}
.IB-container .IB-imagen-1,
.IB-container .IB-imagen-2,
.IB-container .IB-imagen-3,
.IB-container .IB-imagen-4 {
min-height: 250px;
max-height: 250px;
}
}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
href="https://fonts.googleapis.com/css2?family=Poiret+One&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div class="IB-container">
<div class="IB-area-1">
<a
class="IB-image-link"
href="https://google.com"
title="titulo1"
aria-label="titulo1"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-1"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">titulo 1</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
<div class="IB-area-2">
<a
class="IB-image-link"
href="https://google.com"
title="titulo2"
aria-label="titulo2"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-2"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">titulo 2</div>
<div class="IB-text-button IB-btn-small IB-btn-line">Ver Mas</div>
</div>
</div>
</a>
</div>
<div class="IB-area-3">
<a
class="IB-image-link"
href="https://google.com"
title="titulo3"
aria-label="TITULO3"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-3"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">Titulo 3</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
<div class="IB-area-4">
<a
class="IB-image-link"
href="https://google.com"
title="titulo4"
aria-label="titulo4"
>
<div class="IB-contenido">
<div class="IB-imagen IB-imagen-4"></div>
<div class="IB-texto">
<div class="IB-h2 IB-mb-3">Titulo 4</div>
<div class="IB-text-button IB-btn-small IB-btn-line ">
Ver Mas
</div>
</div>
</div>
</a>
</div>
</div>
</body>
</html>