react实现一个比眼力小游戏代码

代码语言:html

所属分类:游戏

代码描述:react实现一个比眼力小游戏代码,对于四类特征(颜色、数字、形状和底纹)中的每一种,这三个小饰物必须显示为a)要么完全相同,要么b)全部不同。

代码标签: 眼力 小游戏

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


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

<head>

  <meta charset="UTF-8">
  

  
  
  
  
<style>
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  background-color: #c9daea;
}

a,
a:visited {
  color: inherit;
}

p {
  margin: 10px 0 16px 0;
  color: inherit;
  color: white;
}

b {
  font-weight: normal;
}

svg {
  animation-name: appear;
  animation-duration: 1.5s;
  animation-iteration-count: 1;
}

@keyframes appear {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  height: 100vh;
  padding
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 240px;
  background-color: #626c66;
  color: white;
  padding: 20px;
  border-radius: 10px;
  font-size: 0.8em;
  margin: 20px 20px 20px 0;
}

button {
  padding: 15px;
  font-size: 1em;
  background-color: #ef5169;
  border: none;
  border-radius: 5px;
  color: white;
  cursor: pointer;
}

.score {
  text-align: center;
  font-weight: bold;
  font-size: 1.5em;
}

.grid {
  margin: 20px;
  padding: 15px;
  display: grid;
  grid-template-columns: repeat(4, minmax(auto, 120px));
  grid-template-rows: repeat(3, minmax(auto, 120px));
  gap: 10px;
  background-color: white;
  border-radius: 10px;
  height: 80vh;
}

.bauble {
  border-radius: 10px;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
}

.less-important {
  display: none;
}

@media (min-width: 980px) and (min-height: 480px) {
  .grid {
    height: auto;
  }
  
  .bauble {
    width: 150px;
    height: 150px;
  }

  .sidebar {
    font-size: 1em;
  }
  
  .less-important {
    display: block;
  }
}

.grid.game .bauble:hover {
  background-color: #f0f6ff;
  cursor: pointer;
}

.bauble.selected {
  background-color: #f0f6ff;.........完整代码请登录后点击上方下载按钮下载查看

网友评论0