【发布时间】:2019-01-10 06:27:09
【问题描述】:
我正在尝试添加一个 CSS 过渡,因此当用户将鼠标悬停在 div 上时,背景会像 https://codepen.io/mrsalami/pen/EpLZMe 一样放大。但是,转换延迟不起作用。
我的 HTML:
<div class="what-we-do" id="home-block" style="background: url('http://www.intrawallpaper.com/static/images/1968081.jpg') center center no-repeat;">
<div class="home-box-text">
<h1>What We Do</h1>
</div>
</div>
我的 CSS:
#home-block {
width: 100%;
transition-delay: 2s;
-moz-transition-delay: 2s;
-ms-transition-delay: 2s;
-webkit-transition-delay: 2s;
-o-transition-delay: 2s;
height: calc((100vh - 133px)/ 3);
-webkit-background-size: 100%;
background-size: 100%;
margin-bottom: 20px;
display: flex;
align-items: center;
justify-content: center;
}
#home-block:hover {
background-size: 150% !important;
}
#home-block .home-box-text {
margin: 0;
}
#home-block .home-box-text h1 {
font-size: 30px;
text-transform: uppercase;
}
#scroll-body {
padding-left: 35px;
}
我的问题的codepen是https://codepen.io/mrsalami/pen/WKJRjr
【问题讨论】:
标签: html css css-transitions