http://lucasdebelder.be/googledoodle/
这是现场版本。

因此,正如您在门户网站上看到的那样,它周围是发光的box-shadow;我想打开和关闭它,使它看起来更真实,我添加了transition: box-shadow ease-in-out;,但它只是在开始时才做,页面加载后,然后保持发光。

这是相关的代码。 (portaal_links表示左侧是门户,rechts表示右侧,这是荷兰语)

HTML:

<div class="portaal portaal_links"></div>
<div class="portaal portaal_rechts"></div>


CSS:

/*portaal general*/
.portaal {
    position: absolute;
    width: 100px;
    height: 200px;
    border-radius: 50px / 100px;
    bottom: 315px;
}



/*portaal left*/
.portaal_links {
    background: radial-gradient(ellipse at center, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    transition: box-shadow ease-in-out;
    transition-delay: 1s;
    transition-duration: 1s;
    box-shadow: 0 0 55px #57B6FF;
    opacity: 0.75;
    left: 50px;
}


.portaal_rechts {
    background: radial-gradient(ellipse at center, rgba(243,197,189,1) 0%,rgba(232,108,87,1) 50%,rgba(234,40,3,1) 51%,rgba(255,102,0,1) 75%,rgba(199,34,0,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    box-shadow: 0 0 55px #FF6600;
    opacity: 0.55;
    left: 750px;
}

最佳答案

使用动画而不是过渡。

关键帧:https://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp

动画:https://www.w3schools.com/css/css3_animations.asp



.test {
  background: red;
  border-radius: 50%;
  width: 100px;
  height: 200px;
  animation: testing 3s linear infinite; }

@keyframes testing {
  25% {
    box-shadow: 0 0 55px rgba(0,0,0,0.9); }
  75% {
    box-shadow: 0 0 0 transparent; }
}

<div class="test"></div>

09-07 21:23
查看更多