css+js实现猜词绞刑上吊游戏代码

代码语言:html

所属分类:游戏

代码描述:css+js实现猜词绞刑上吊游戏代码,总共这几个单词,拼凑对了就通过,错误就上吊。 "array", "variable", "value", "property", "object", "javascript", "cascad", "data", "string", "number", "console"

代码标签: css js 猜词 绞刑 上吊 游戏 代码

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">

  <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet">
<style>
    :root {
  --main-bg: #1d1e22;
  --stroke-color: #f2f2f2;
  --stroke-width: 3px;
}

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

body {
  font-family: "Permanent Marker", cursive;
  color: #ffffff;
  background-color: var(--main-bg);
}

.container {
  display: flex;
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
  gap: 5rem;
  max-width: 992px;
  min-height: 100vh;
  margin: auto;
  padding: 1rem;
}

.hangman {
  display: flex;
  justify-content: center;
  align-content: center;
  width: 10rem;
  height: 10rem;
  padding: 0 2rem;
}

.hangman__scaffold {
  position: relative;
  width: 6rem;
  height: 100%;
  border-left: var(--stroke-width) solid var(--stroke-color);
  border-top: var(--stroke-width) solid var(--stroke-color);
  background: linear-gradient(
    -225deg,
    transparent 0,
    transparent 13px,
    var(--stroke-color) 13px,
    var(--stroke-color) 16px,
    transparent 16px
  );
}

.hangman__scaffold::before,
.hangman__scaffold::after {
  content: "";
  position: absolute;
  display: block;
  width: 100%;
  border-color: var(--stroke-color);
  border-width: var(--stroke-width);
}

.hangman__scaffold::before {
  top: 0;
  right: 0;
  height: 2rem;
  border-right-style: solid;
}

.hangman__scaffold::after {
  inset: 0;
  transform: translatex(-50%);
  width: 120%;
  height: 100%;
  border-bottom-style: solid;
}

.hangman__man {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  translate: -1rem 0;
}

.hangman__head {
  width: 2rem;
  height: 2rem;
  border: var(--stroke-width) solid var(--stroke-color);
  border-radius: 50%;
  transition: all 0.3s ease-out;
}

.hangman__eyes {
  display: flex;
  justify-content: space-around;
  padding: 0.4rem 0.2rem;
}

.hangman__eye {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
}

.hangman__eye::before,
.hangman__eye::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--stroke-color);
  transition: all 0.3s ease-out;
}

.hangman__eye::before {
  rotate: 45deg;
}

.hangman__eye::after {
  rotate: -45deg;
}

.hangman__body {
  position: relative;
  width: var(--stroke-width);
  height: 3rem;
  background-color: var(--stroke-color);
  transition: all 0.3s ease-out;
}

.hangman__limbs {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  width: 3rem;
  height: 3rem;
}

.hangman__limbs--top {
  top: 0.5rem;
}

.hangman__limbs--bottom {
  bottom: -3.3rem;
}

.hangman__limb {
  width: 100%;
  height: var(--stroke-width);
  background-color: var(--stroke-color);
  transition: all 0.3s ease-out;
}

.hangman__limb--left {
  rotate: -45deg;
  margin-right: -6px;
}

.hangman__limb--right {
  rotate: 45deg;
  margin-left: -6px;
}

.letters {
  display: flex;
  justify-content: center;
  align-items: end;
  flex-wrap: wrap;
  gap: 1rem;
}

.letter {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  font-family: inherit;
  color: inherit;
  background: none;
  text-transform: uppercase;
}

.letter--word {
  border-bottom: var(--stroke-width) solid var(--stroke-color);
}

.letters--alphabet {
  width: 100%;
}

.letter--alphabet {
  border: 1px solid var(--stroke-color);
  cursor: pointer;
  transition: all 0.3s linear;
}

.letter--alphabet:not(:disabled):hover {
  box-shadow: 0 0 10px 0 var(--stroke-color);
}

.hidden {
  opacity: 0;
}

.letter:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.restart-button {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: block;
  padding: 1rem 2rem;
  font: inherit;
  letter-spacing: 0.2rem;
  border: var(--stroke-width) solid var(--stroke-color);
  color: var(--stroke-color);
  background-color: var(--main-bg);
  cursor: pointer;
  overflow: hidden;
}

.restart-button:before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: 0;
  height: 150%;
  background-color: rebeccapurple;
  mix-blend-mode: difference;
  transition: all 0.5s ease-in-out;
  border-radius: 50%;
}

.restart-button:hover::before {
  width: 150%;
}

@media (max-width: 768px) {
  .restart-button {
    padding: 0.5rem 1rem;
    font-size: 0.5rem;
  }
}
</style>

</head>
<body>
<!-- partial:index.partial.html -->
<div class="container">
    <div class="hangman">
      <div class="hangman__scaffold"></div>
      <div class="hangman__man">
        <div class="hangman__head man-part hidden">
          <div class="hangman__eyes hidden">
            <div class="hangman__eye"></div>
            <div class="hangman__eye"></div>
          </div>
        </div>
        <div class="hangman__body man-part hidden">
          <div class="hangman__limbs hangman__limbs--top">
            <div class="hangman__limb hangman__limb--left man-part hidden"></div>
            <div class="hangman__limb hangman__limb--right man-part hidden"></div>
          </div>
          <div class="hangman__limbs hangman__limbs--bottom">
            <div class="hangman__limb hangman__limb--left man-part hidden"></div>
            <div class="hangman__limb hangman__limb--right man-part hidden"></div>
          </div>
        </div>
      </div>
    </div>

    <div class="letters letters--word" id="w.........完整代码请登录后点击上方下载按钮下载查看

网友评论0