gpt4 book ai didi

html - 为什么这个动画适用于除 chrome 之外的所有浏览器? (有前缀)

转载 作者:行者123 更新时间:2023-11-28 12:54:31 25 4
gpt4 key购买 nike

HTML

<div class="container-screenz service-graphic sg2">
<div class="screenz monitor">
<img src="img/geoqueri-monitor.jpg">
</div>
<div class="laptop">
<div class="screenz">
<img src="img/geoqueri-laptop.jpg">
</div>
<div class="btm"></div>
</div>
<div class="phone">
<div class="screenz">
<img src="img/geoqueri-phone.jpg">
</div>
<div class="shadow"></div>
</div>
<div class="ipad">
<div class="screenz">
<img src="img/geoqueri-tablet.jpg">
</div>
</div>
</div>

CSS(添加前缀)

@keyframes scroll {
20%,
60% {
-webkit-transform:translateY(-62%);
-moz-transform:translateY(-62%);
-ms-transform:translateY(-62%);
-o-transform:translateY(-62%);
transform:translateY(-62%);
}
80% {
margin-top: -50px;
}
}


.service-graphic {
max-width: 42.500em;
font-size: 8px;
padding: 1em;
position: relative;
display: block;
margin: 0 auto;

.monitor {
width: 28.750em;
height: 17.5em;
position: relative;
background: #f8f8f8;
border: 0.625em solid #1f1f1f;
@include border-radius(0.625em);
border: 1.25em solid #1f1f1f;
margin: 0 auto;

.content-screenz {
width: 26.25em;
height: 15em;
left: 50%;
margin-left: -13.125em;
overflow: hidden;
}

&:before, &:after {

content: "";
position: absolute;
left: 50%;

}

&:before {
top: -0.25em;
margin: -0.188em 0 0 -0.188em;
width: 0.250em;
height: 0.250em;
@include border-radius(0.250em);
background: #d8dbe1;
top: -0.625em;

}

}

.laptop {

&:before {
content: "";
position: absolute;
left: 50%;
top: -0.25em;
margin: -0.188em 0 0 -0.188em;
width: 0.250em;
height: 0.250em;
@include border-radius(0.250em);
background: #d8dbe1;
top: -0.625em;
}

}

}


.screenz {
&:after {
width: 0.500em;
height: 0.500em;
@include border-radius(0.500em);
margin: 0 0 -0.25em -0.25em;
background: #e8ebf0;
bottom: -0.625em;

}
}

.monitor > div {
position: absolute;

}



.monitor .content-screenz:before,
.laptop .screenz:before,
.phone .screenz:before,
.ipad .screenz:before {
content: "";
position: absolute;
right: -5.625em;
width: 12.500em;
height: 18.750em;
-webkit-transform:rotate(45deg);
-moz-transform:rotate(45deg);
-ms-transform:rotate(45deg);
-o-transform:rotate(45deg);
transform:rotate(45deg);

/*linear-gradient*/
background:-webkit-gradient(linear,left top,left bottom,color-stop(rgba(255, 255, 255, 0.5),0),color-stop(rgba(255, 255, 255, 0),1));
/*@@prefixmycss->No equivalent*/
background:-webkit-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background: -moz-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background: -o-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);

z-index: 5;
}


.browser {
width: 15em;
height: 11.250em;
position: absolute;
left: 50%;
top: 50%;
margin: -5.625em 0 0 -7.5em;
background: #ffffff;
border: 1px solid #e8ebf0;
border-top: 1.25em solid #d8dbe1;
@include border-radius(0.313em);
}
.browser-content {
overflow: hidden;
height: 9.938em;
padding-top: 0.625em;
}
.btns {
position: absolute;
top: -1.25em;
left: 0.438em;

&:before {
content: "";
position: absolute;
left: 2.188em;
top: 0.313em;
height: 0.625em;
width: 11.563em;
background: #fff;
@include border-radius(3px);

}
}


.btns > li {
display: inline-block;
list-style: none;
width: 0.313em;
height: 0.313em;
@include border-radius(0.313em);
background: #fc5254;
margin-right: 0.250em;
}

.btns li:nth-child(2) {
background: #fcae52;
}
.btns li:nth-child(3) {
background: #66b34e;
}
.base {
width: 5.625em;
height: 3.1em;
bottom: -3.9em;
left: 50%;
margin-left: -2.8125em;
background: #e8ebf0;
bottom: -4.3em;
z-index: -1;
}
.base:before,
.base:after,
.grey-shadow:before,
.grey-shadow:after {
content: "";
position: absolute;
top: 0;
}
.base:before {
border-left: 0.813em solid transparent;
border-right: 0px solid transparent;
border-bottom: 3.125em solid #e8ebf0;
left: -0.77em;
}
.base:after {
border-right: 0.813em solid transparent;
border-left: 0px solid transparent;
border-bottom: 3.125em solid #e8ebf0;
right: -0.77em;
}
.base > div {
position: absolute;
}
.grey-shadow {
width: 5.625em;
height: 0.750em;
background: #d8dbe1;
top: 0;
}
.grey-shadow:before {
border-left: 3px solid transparent;
border-right: 0px solid transparent;
border-bottom: 0.75em solid #d8dbe1;
left: -3px;
}
.grey-shadow:after {
border-right: 3px solid transparent;
border-left: 0px solid transparent;
border-bottom: 0.75em solid #d8dbe1;
right: -2px;
z-index: 1;
}
.foot {
background: #e8ebf0;
}
.foot.top {
width: 7.250em;
height: 0.313em;
bottom: -0.3em;
left: 50%;
margin-left: -3.625em;
}
.foot.top:before,
.foot.top:after,
.foot.bottom:before {
content: "";
position: absolute;
top: 0px;
}
.foot.top:before {
border-left: 16px solid transparent;
border-right: 0px solid transparent;
border-bottom: 5px solid #e8ebf0;
left: -16px;
}
.foot.top:after {
border-right: 1em solid transparent;
border-left: 0px solid transparent;
border-bottom: 5px solid #e8ebf0;
right: -1em;
}
.foot.bottom {
width: 9.375em;
height: 0.313em;
bottom: -0.625em;
left: 50%;
margin-left: -4.688em;
}
.laptop {
width: 14.688em;
height: 9.688em;
background: #f8f8f8;
border: 0.75em solid #1f1f1f;
-webkit-border-radius:10px 10px 0 0;
-moz-border-radius:10px 10px 0 0;
border-radius:10px 10px 0 0;
position: absolute;
top: 14.5em;
right: 1.875em;
z-index: 10;
}
.laptop:before {
top: -0.3em;
}
.laptop > div {
position: absolute;
}
.laptop > .screenz {
width: 13.188em;
height: 8.188em;
left: 0;
margin-left: 0;
background: #fff;
overflow: hidden;
}
.btm {
width: 18.500em;
height: 0.625em;
bottom: -1.188em;
left: 50%;
margin-left: -9.25em;
-webkit-border-radius:0 0 20px 20px;
-moz-border-radius:0 0 20px 20px;
border-radius:0 0 20px 20px;
background: #e8ebf0;
z-index: 1;
}
.btm:before {
content: "";
position: absolute;
width: 42px;
height: 4px;
left: 50%;
top: 0;
margin-left: -21px;
-webkit-border-radius:0 0 5px 5px;
-moz-border-radius:0 0 5px 5px;
border-radius:0 0 5px 5px;
background: #d8dbe1;
}
.btm:after {
display: none;
content: "";
position: absolute;
width: 100%;
height: 0.25rem;
background: #bababa;
top: .5rem;
border-bottom-right-radius: 7.5rem 2.5rem;
border-bottom-left-radius: 7.5rem 2.5rem;
}
.phone {
width: 4.125em;
height: 8.750em;
position: absolute;
top: 15.75em;
left: 1em;
@include border-radius(0.5em);
background: #1f1f1f;
border: 1.563em solid #1f1f1f;
border-left: 0.313em solid #1f1f1f;
border-right: 0.313em solid #1f1f1f;
}
.phone:before,
.phone:after {
content: "";
position: absolute;
left: 50%;
background: #474e5d;
}
.phone:before {
background: #474e5d;
width: 1.250em;
height: 0.250em;
margin-left: -0.625em;
top: -0.75em;
@include border-radius(2px);
}
.phone:after {
width: 0.625em;
height: 0.625em;
@include border-radius(0.625em);
bottom: -1.125em;
margin-left: -0.313em;
}

.phone .screenz {
width: 3.50em;
height: 5.625em;
margin: 0 auto;
position: relative;
overflow: hidden;
background: #fff;
}

.ipad {
width: 8.75em;
height: 12.750em;
position: absolute;
top: 11.7em;
left: 6em;
@include border-radius(0.5em);
background: #1f1f1f;
border: 1.563em solid #1f1f1f;
border-left: 0.313em solid #1f1f1f;
border-right: 0.313em solid #1f1f1f;
}
.ipad:before,
.ipad:after {
content: "";
position: absolute;
left: 50%;
background: #474e5d;
}
.ipad:before {
background: #474e5d;
width: 1.250em;
height: 0.250em;
margin-left: -0.625em;
top: -0.75em;
@include border-radius(2px);
}
.ipad:after {
width: 0.625em;
height: 0.625em;
@include border-radius(0.625em);
bottom: -1.125em;
margin-left: -0.313em;
}
.ipad .screenz {
width: 8em;
height: 9.8em;
margin: 0 auto;
position: relative;
overflow: hidden;
background: #fff;
}
.ipad .content {
width: 100%;
left: 0%;
margin-left: 0px;
}


.monitor , .laptop, .ipad, .phone {
overflow: hidden;

img {
padding: 0 !important;
width: 100%;
height: 880px;
-webkit-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
-moz-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
-ms-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
-o-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;

&:hover {
opacity: 1 !important;
}

}
}



@media screen and (min-width: 38em) {

.service-graphic {
font-size: 12px;
.monitor {
border: 1.25em solid #1f1f1f;
}

}

}

原始未修改代码笔:

http://codepen.io/nicholaspetersen/pen/BHjfk

所以我所做的是,我将 LESS 转换为 CSS(因为我不知道 LESS)使用 http://less2css.org/

动画在 Firefox 上完美运行,但在 Chrome 上却不行。所以我检查了代码并添加了所有缺少的前缀,正如您在我提供的 CSS 代码中看到的那样,它仍然不起作用。我现在一头雾水,为什么这可以在 Firefox 上运行,但不能在 Chrome 上运行?

谢谢

最佳答案

仅仅在关键帧动画中添加前缀转换是不够的,您还需要为关键帧声明本身添加前缀。例如:

@-webkit-keyframes foo {
0% {
-webkit-transform: scale(0);
}
100% {
-webkit-transform: scale(1);
}
}

同样值得注意的是,您可以通过单击 CSS Pane 中的“眼睛”图标在 codepen 中查看已编译的 LESS。希望这对芽有帮助

关于html - 为什么这个动画适用于除 chrome 之外的所有浏览器? (有前缀),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22823474/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com