【发布时间】:2017-06-09 23:28:34
【问题描述】:
目前,我有一个网站,其中图像与上面的文字发生冲突。
我是 HTML/CSS 的新手,并且在网上浏览过,但运气不佳。基本上,当用户没有将鼠标悬停在一个框上时,图像应该会显示有点褪色,顶部有文字。当使用将鼠标悬停在框上时,图像应该是?
.showcase {
overflow: hidden;
margin-left: -1px;
@include flexbox;
@include justify-content(center);
}
.custom_showcase {
position: relative;
padding: 1px 0 0 1px;
@include flexbox;
img {
width: 100%;
max-width: none;
}
.inside {
display: inline-block;
max-width: 100%;
width: 100%;
background: $color_1;
@include flexbox;
@include align-items(center);
}
.textblock {
padding: 20px;
}
img + .textblock {
position: absolute;
left: 50%;
top: 50%;
width: 100%;
max-width: 455px;
padding: 0 20px;
color: $color_3;
@include transform(translate(-50%,-50%));
}
h2 {
color: $color_3;
margin: 16px 0 5px;
text-transform: uppercase;
}
p {
margin: 0;
color: $color_3;
}
h2,
p {
span {
display: inline-block;
padding-left: 0;
@include transition(.4s);
}
}
.text {
width: 100%;
}
.btn_wrapper {
position: absolute;
right: 40px;
top: 50%;
@include transform(translate(0%,-50%));
.btn {
padding: 0 10px;
min-width: 140px;
text-align: center;
opacity: 0;
@include transition(.4s);
@include transform(translate(100%,0%));
/* border-color: $color_3; */
}
}
a:not(:hover) {
//h2,
//p {
// span {
// padding-right: 0 !important;
// }
//}
opacity: .5;
transition: opacity 0.5s ease;
}
a:hover {
h2,
p {
span {
padding-left: 0 !important;
}
}
.btn_wrapper {
.btn {
opacity: 1;
@include transform(translate(0%,0%));
}
}
}
【问题讨论】:
-
你能通过简单地查看你提供的 CSS 来想象这个问题吗?因为我做不到。
-
"当使用鼠标悬停在框上时,图片应该是什么?"应该是什么?
-
根据您的描述,这是一个猜谜游戏,但您是否要尝试这样做? codepen.io/anon/pen/MoKZMa
-
@MichaelCoker 是的,基本上是这样,但反过来……如果这有意义的话。其中未悬停 = 原始图像,悬停 = 顶部带有文本的褪色图像
-
@JulianCastaneda 罗杰。已提交答案。