【发布时间】:2019-09-14 03:58:31
【问题描述】:
我正在尝试在我的网站上获得这种效果。例如:https://rno1.com/
(向下滚动到“我们专注于”)
我对 HTML 和 CSS 非常陌生,而且我正在研究 WordPress,这使得它有点困难。 开始在 StackOverflow 上用这个问题编写代码:
Change body background image on hover with pure html/css
但我想在交换图像之间添加一个过渡,我还需要在哪里更改字体属性?
div.link>a {
displya: inline-block !important;
position: relative !important;
z-index: 100;
}
.bg1:hover+.background {
background: url(https://aviel-albo.com/wp-content/uploads/2019/04/divorce-min.jpg);
}
.bg2:hover+.background {
background: url(https://aviel-albo.com/wp-content/uploads/2019/04/Fotolia_37279445_Subscription_Monthly_M-min.jpg);
}
.background {
background: transparent;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
<div class=container>
<div class="link">
<a href="#" class="bg1">bg1</a>
<div class=background></div>
<a href="#" class="bg2">bg2</a>
<div class=background>
</div>
</div>
</div>
【问题讨论】: