【发布时间】:2016-01-17 12:07:26
【问题描述】:
我正在尝试复制在此站点 here 上看到的脉冲效果(大约中途向下滚动)
我已将网站的 CSS 缩小到他们在此 CodePen 中使用的两个 div,但无法使其正常工作。
HTML
<div class="pulse">
<div class="status"> </div>
</div>
CSS
.pulse {
border-radius: 50px;
height: 60px;
left: 50%;
letter-spacing: 0.05em;
line-height: 50px;
position: absolute;
text-align: center;
text-transform: uppercase;
top: 50%;
transform: translate(-50%, -50%);
width: 60px;
}
.pulse:before {
-webkit-animation: pulse 2s infinite linear;
background: rgba(99, 87, 63, 0.5);
border-radius: 50px;
content: '';
height: 100%;
left: 0;
opacity: 0;
position: absolute;
top: 0;
transform: scale(1);
width: 100%;
}
.pulse:after {
-webkit-animation: pulse 2s 1s infinite linear;
background: rgba(99, 87, 63, 0.5);
border-radius: 50px;
content: '';
height: 100%;
left: 0;
opacity: 0;
position: absolute;
top: 0;
width: 100%;
}
.status {
background: #63573f;
border-radius: 100% 100%;
box-shadow: 0 0 4px 0px #eed4c3 inset;
height: 15px;
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
width: 15px;
}
它看起来像是纯 CSS,但我可能是错的。 CodePen 和网站的代码有什么区别?
【问题讨论】: