gpt4 book ai didi

html - CSS 动画在 Internet Explorer 中不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 19:30:57 26 4
gpt4 key购买 nike

我有一个 HTML/CSS 网页。本页面背景图片不断变化。它在 Chrome 中有效,但在 Internet Explorer 中无效——背景图像保持不变。我想指出的是,它不会为您正确显示,因为不包括图像。

HTML/CSS:

<!doctype html>
<html>
<title>Macht IT Solutions</title>
<head>
<style>
#body1 {
position: relative;
background-Color: white;
font-color: white;
width: 1000px;
margin: 0 auto;
z-index: -1;
}

#body2 {

position: absolute;
top: 140px;
font-color: white;
width: 1000px;
height: 1000px;
margin: 0 auto;
z-index: 0;
}

#background {
opacity: 0.8;
position: absolute;
top: 0px;
background-image: url("back.jpg");
font-color: white;
width: 1000px;
height: 1000px;
margin: 0 auto;
z-index: 1;
-webkit-animation-name: bodyback;
-webkit-animation-duration: 30s;
-webkit-animation-iteration-count: infinite;
animation-name: bodyback;
animation-duration: 30s;
animation-delay: 5s;
-webkit-animation-delay: 5s;
animation-iteration-count: infinite;
animation-timing-function: ease-in;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
}

#logo {
border: 1px solid black;
background-color: black;
color: white;
padding: 5px;
border-radius: 5px 0px 5px 0px;
background-image: url("networking.jpg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
height: 130px;
}

#about {
position: absolute;
top: 10px;
color: black;
border: 1px solid blue;
background-color: white;
border-radius: 5px 0px 5px 5px;
padding: 4px;
width: 500px;
z-index: 2;
}

#aboutmetext {
position: absolute;
top: 100px;
background-color: white;
color: black;
float: left;
width: 500px;
border: 1px solid blue;
padding: 4px;
border-radius: 5px 30px 20px 20px;
z-index: 2;
}

#video {
position: absolute;
top: 30px;
left: 550px;
border: 1px solid blue;
background-color: white;
float: right;
overflow: hidden;
border-radius: 10px 10px 0px 0px;
height: 360px;
z-index: 2;
}

#serv {
position: absolute;
top: 400px;
float: left;
width: 500px;
border: 1px solid blue;
padding: 4px;
border-radius: 5px 30px 20px 20px;
color: black;
background-color: white;
z-index: 2;
}

#services {
position: absolute;
top: 300px;
font-color: black;
float: left;
height: 30px;
border: 1px solid blue;
padding: 4px;
background-color: white;
border-radius: 5px 0px 5px 0px;
color: black;
width: 500px;
z-index: 2;
}

#contactus {
position: absolute;
top: 550px;
float: left;
height: 30px;
border: 1px solid blue;
padding: 4px;
background-color: white;
border-radius: 5px 0px 5px 0px;
color: black;
z-index: 2;
}

#contact {
position: absolute;
top: 650px;
float: left;
width: 500px;
border: 1px solid blue;
padding: 4px;
border-radius: 5px 30px 20px 20px;
color: black;
background-color: white;
z-index: 2;
}

@KeyFrames bodyback {
0% {
background-image: url("back.jpg");
}
25% {
background-image: url("net1.jpg");
}
50% {
background-image: url("net2.jpg");
}
100% {
background-image: url("net3.jpg");
}
}

@-webkit-keyframes bodyback {
0% {
background-image: url("back.jpg");
}
25% {
background-image: url("net1.jpg");
}
50% {
background-image: url("net2.jpg");
}
100% {
background-image: url("net3.jpg");
}
}

@KeyFrames {
}

@KeyFrames {
}

@KeyFrames {
}
</style>
</head>
<body id="body1">
<div id="logo" style="font-size:30px">
<img src="machtlogo1.png" height="100" width="100"> Macht IT Solutions
</div>
<div id="body2">
<div id="background"></div>
<h1 id="about">About us</h1>

<div>
<p id="aboutmetext">
<font>
</font>
</p>

<div id="video">
<p align="center">
<font color="black">
<b>
What is the Internet?
</b>
</font>
</p>
<iframe width="420" height="315" src="https://www.youtube.com/embed/Jj6EHgSsx_U?autoplay=0">
</iframe>
</div>
</div>
<div>
<h1 id="services"><font color="black">Services</font></h1>
</div>
<div id="serv">
<p>
<font color="black">
inquiry.
</font>
</p>
</div>
<div>
<h1 id="contactus"><font color="black">Contact us</font></h1>
</div>
<div id="contact">
<p>
<font color="black">
</font>
</p>
</div>
</div>
</body>
</html>

最佳答案

根据CSS Transitionsbackground-image 属性不可设置动画。规范。

在撰写本文时,您不应该期望它能在任何浏览器中运行。这在未来可能会改变,但随着对实现进行试验,并且标准机构继续推进对新功能和创造性功能的支持。

如果您想在此期间换掉背景图片,您应该使用脚本,或者通过在单个元素上设置单个背景图片的位置/大小的动画,而不是尝试设置背景本身的动画。

关于html - CSS 动画在 Internet Explorer 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30380672/

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