css+js实现随机生成不同大小气泡进行冒泡排序代码

代码语言:html

所属分类:其他

代码描述:css+js实现随机生成不同大小气泡进行冒泡排序代码

代码标签: css js 随机 生成 不同 大小 气泡 进行 冒泡 排序 代码

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

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

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
body {
	height: 100vh;
	margin: 0;
	min-height: 100vh;
	display: grid;
	place-items: center;
	background: #16a085;
	background: linear-gradient(
		213deg,
		#30336b 0%,
		#16a085 100%
	) fixed;
  color: white;
}
#bubbleArea{
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
}
.bubble {
	font-size: 1.5rem;
	margin: 0.15rem;
	width: fit-content;
}
.bubble {
	width: 7vw;
	position: relative;
	height: 7vw;
	display: flex;
	justify-content: center;
	align-items: center;
	background: radial-gradient(
		#00000000 45%, #ffffff95 85%
	);
	border: 1px solid white;
	border-radius: 50%;
	animation: 1s moveRandom infinite;
}
.bubble::before{
	content: "";
	display: block;
	width: 0.25vw;
	height: 0.25vw;
	background: white;
	border-radius: 151% 51%;
	position: absolute;
	left: 31%;
	border: 1px solid white;
	top: 25%;
}
.bubble::after{
	content: "";
	display: block;
	width: 0.95vw;
	height: 0.95vw;
	background: white;
	border-radius: 151% 51%;
	position: absolute;
	left: 19%;
	top: 15%;
}
#generateBtn, #sortBtn{
  color: #eee;
  padding: 7px 13px;
  border: none;
  border-radius: 1px;
  background: #2c3e50;
	font-family: Monospace;
}
#generateBtn:hover, #sortBtn:hover{
  background: #c0392b;
}
#generateBtn:active, #sortBtn:active{
  background: #e74c3c;
}
</style>

  
  
  
</head>

<body translate="no">
  <div id="container">
	<button id="generateBtn">Generate Numbers</button>
	<button id="sortBtn">Bubble Sort!</button>
	<div id="bubbleArea">&.........完整代码请登录后点击上方下载按钮下载查看

网友评论0