svg+css实现白天黑夜切换radio按钮点击背景切换代码

代码语言:html

所属分类:其他

代码描述:svg+css实现白天黑夜切换radio按钮点击背景切换代码

代码标签: svg css 白天 黑夜 切换 radio 按钮 点击 背景 切换 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  
  
  
<style>
:root {
	--morning-color: #60a5fa;
	--night-color: #7c3aed;
	--morning-bg: #87ceeb;
	--night-bg: #1a237e;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	justify-content: center;
	align-items: center;
	font-family: system-ui, sans-serif;
	background-color: var(--morning-bg);
	transition: background-color 0.5s ease;
	position: relative;
	overflow: hidden;
}

.background-elements {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.clouds {
	position: absolute;
	width: 100%;
	height: 100%;
	opacity: 1;
	transition: opacity 0.5s ease;
}

.cloud {
	position: absolute;
	width: 180px;
	height: 60px;
	opacity: 0.9;
}

.cloud:nth-child(1) {
	top: 12%;
	animation: float 25s linear infinite;
	animation-delay: -18s;
	transform: scale(0.9);
}
.cloud:nth-child(2) {
	top: 28%;
	animation: float 22s linear infinite;
	animation-delay: -3s;
	transform: scale(1.1);
}
.cloud:nth-child(3) {
	top: 45%;
	animation: float 28s linear infinite;
	animation-delay: -12s;
	transform: scale(0.85);
}
.cloud:nth-child(4) {
	top: 33%;
	animation: float 20s linear infinite;
	animation-delay: -7s;
	transform: scale(1.2);
}
.cloud:nth-child(5) {
	top: 67%;
	animation: float 24s linear infinite;
	animation-delay: -15s;
	transform: scale(0.95);
}
.cloud:nth-child(6) {
	top: 52%;
	animation: float 26s linear infinite;
	animation-delay: -4s;
	transform: scale(1.15);
}
.cl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0