首页 - 素材教程 - 素材百科 - html动态背景模板-大家有没有好的动态网页背景的源代码???

html动态背景模板-大家有没有好的动态网页背景的源代码???

原创:素材网 2023-08-01 13:36:39

css如何实现网页背景动态渐变效果

HTML部分:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title> 渐变——天际线</title>

<link rel="stylesheet" type="text/css" href="">

</head>

<body>

<div>

渐变——天际线

</div>

</body>

</html>实现背景颜色渐变不需要在HTML(结构)部分做任何操作 这里加了一行字,方便显示效果;

(推荐教程:CSS教程)

CSS部分:

body{

margin: 0;

padding: 0;

font-family: "montserrat";

background-image: linear-gradient(125deg,#E4FFCD,#6DD5FA,#2980B9,#E4FFCD); background-size: 400%;

animation: bganimation 15s infinite;

}

.text{

color: white;

text-align: center;

text-transform: uppercase;

margin: 400px 0;

font-size: 22px;

}

@keyframes bganimation {

0%{

background-position: 0% 50%;

}

50%{

background-position: 100% 50%;

}

100%{

background-position: 0% 50%;

}

}效果如图:

要点:

background-image: linear-gradient();linear-gradient() 函数用于创建一个线性渐变的 "图像"。为了创建一个线性渐变,你需要设置一个起始点和一个方向(指定为一个角度)的渐变效果。你还要定义终止色。终止色就是你想让Gecko去平滑的过渡,并且你必须指定至少两种,当然也会可以指定更多的颜色去创建更复杂的渐变效果。

其中的“125deg” 是设置渐变的倾斜角度;

background-position:属性设置背景图像的起始位置。

也可以试试这种桌布渐变:

background:white;

background-image: linear-gradient(90deg,

rgba(200,0,0,.5) 50%, transparent 0),

linear-gradient(

rgba(200,0,0,.5) 50%, transparent 0);

background-size: 30px 30px;推荐视频教程:css视频教程

大家有没有好的动态网页背景的源代码???

一个动态变换网页背景色的代码,还可以自己添加其他的颜色。

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>这是一个动态变换网页背景色的例子</title>

</head>

<body>

<script language="vbscript">

<!--

sub setbgcolor(changec)

=changec

end sub

-->

</script>

<form>

<input type=radio name="color" onclick=setbgcolor("red")>red<br>

<input type=radio name="color" onclick=setbgcolor("green")>green<br>

<input type=radio name="color" onclick=setbgcolor("black")>black<br>

<input type=radio name="color" onclick=setbgcolor("yellow")>yellow<br>

<input type=radio name="color" onclick=setbgcolor("gray")>gray<br>

<input type=radio name="color" onclick=setbgcolor("blue")>blue<br>

<input type=radio name="color" onclick=setbgcolor("white")>还原默认值<br>

</form>

</body>

</html>

怎样用CSS3和JS做出上升的方块动态背景

我们知道CSS3是可以做出很多酷炫的动画的,那么如果CSS3和JS结合起来使用那该有多么强大呢?今天教大家怎样用CSS和JS制作出上升的方块的动态背景,一起来看一下。

HTML:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Glunefish</title>

<link rel="stylesheet" href="css/">

</head>

<body>

<div id="F-dynamicbg-box">

<div> </div>

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

</div>

</body>

</html>CSS:

* { margin: 0; padding: 0; border: none; outline: 0; }

body{ width: 100vw; height: 100vh; background: url(img/) no-repeat; background-size: cover; }

#F-dynamicbg-box { width: 100vw; height: 100vh; position: absolute; top: 0; left: 0; overflow: hidden; }

#F-dynamicbg-box > div { z-index: -9999; background-color: rgba(255,255,255,.1); position: absolute; top: 105vh; animation: dynamicDiv 30s linear infinite; }

#F-dynamicbg-box > div:nth-of-type(1) { animation-delay: 1s }

#F-dynamicbg-box > div:nth-of-type(2) { animation-delay: 3s }

#F-dynamicbg-box > div:nth-of-type(3) { animation-delay: 6s }

#F-dynamicbg-box > div:nth-of-type(4) { animation-delay: 9s }

#F-dynamicbg-box > div:nth-of-type(5) { animation-delay: 12s }

#F-dynamicbg-box > div:nth-of-type(6) { animation-delay: 4s }

#F-dynamicbg-box > div:nth-of-type(7) { animation-delay: 15s }

#F-dynamicbg-box > div:nth-of-type(8) { animation-delay: 18s }

#F-dynamicbg-box > div:nth-of-type(9) { animation-delay: 20s }

#F-dynamicbg-box > div:nth-of-type(10) { animation-delay: 16s }

@keyframes dynamicDiv { form { top: 105vh; transform: scale(1.2); }

to { top: -13vh; transform: scale(1) rotate(60deg); } }

JS:( JS初始化div形态 )

var box = ('F-dynamicbg-box'), div = ('div'), math = [0,1];for (var i=0;i<;i++) { math[1] = F_getSJS(100,40,9) F_getSJS 请移步博客之前的取随机数了解if(math[1] != math[2]){ div[i]. = math[1] + 'px'; div[i]. = math[1] + 'px'; math[2] = math[1]; } } for(var i=0;i<;i++){ div[i]. = F_getSJS(85,15,8) + 'vw'; div[i]. = 'rotate(' + F_getSJS(360,5,9) + 'deg)'; }所有的代码都在这里了,感兴趣的朋友可以自己动手操作一下,,更多精彩请关注Gxl网其它相关文章!

相关阅读:

HTML里的最后一行文字显示不全怎么处理

CSS网页错位怎么处理

CSS3的loading特效怎么制作

< 上一篇 word背景模板-如何打印预览word背景模板 下一篇 > 封面背景模板-腾讯文档怎么在手机上设置封面背景可以编辑
相关推荐
校园卫生海报-创建卫生城市宣传海报-怎么设计环保海报?
插画培训培训-插画培训机构推荐
海报奶茶招聘模板-奶茶店招聘信息怎么写?
校园纳新海报-社团纳新海报尺寸-动漫社招新海报制作要怎么作