纯css编写的拖动鼠标在桥上过河小游戏代码

代码语言:html

所属分类:弹出层

代码描述:纯css编写的拖动鼠标在桥上过河小游戏代码,玩法:将你的鼠标从绿色起点开始沿着白线路径移动到底部,如果鼠标没有离开白线算闯关成功。

代码标签: css 拖动 鼠标 桥上 过河 游戏

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

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

<head>

 
<meta charset="UTF-8">

 
<meta charset="UTF-8">


 
 
<style>
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro");
.ip-twitter-icon {
  background-image: url("https://assets.codepen.io/44572/twitter_1.png");
  background-color: white;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 30px;
  border-radius: 50% 0 0 0;
  bottom: 0;
  box-shadow: -2px -2px 5px 1px rgba(0, 0, 0, 0.5);
  height: 50px;
  position: fixed;
  right: 0;
  transition: transform 0.3s linear;
  width: 50px;
  z-index: 1000;
}

.ip-twitter-icon:hover {
  transform: scale(1.2);
}

* {
  background-repeat: no-repeat;
  box-sizing: border-box;
  outline: 0;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
*:before, *:after {
  background-repeat: no-repeat;
  box-sizing: border-box;
  outline: 0;
}

html, body, .wrapper {
  align-items: center;
  background-color: #12798e;
  display: grid;
  font-family: "Source Sans Pro", sans-serif;
  height: 100vh;
  justify-content: center;
  margin: 0;
  overflow: hidden;
  padding: 0;
  width: 100vw;
}

.wrapper:hover .gameover {
  display: none;
}

@media (max-width: 767px) {
  .mobile {
    display: grid;
    background-color: #fff;
    border: solid 1px black;
    box-shadow: 0 0 15px 5px rgba(0, 0, 0, 0.5);
    flex-direction: column;
    left: 50%;
    max-width: 200px;
    padding: 20px;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
  }

  .instruction,
.game {
    display: none;
  }
}
@media (min-width: 768px) {
  .mobile {
    display: none;
  }

  .instruction {
    display: flex;
  }

  .game {
    height: 400px;
    width: 400px;
    display: grid;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate3d(-50%, -50%, 0);
  }

  .gameover {
    align-items: center;
    align-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: none;
    font-size: 24px;
    flex-wrap: wrap;
    height: 100%;
    justify-content: center;
    position: absolute;
    text-align: center;
    text-shadow: 1px 1px 2px black;
    width: 100%;
    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;
  }
  .gameover:hover {
    display: flex;
  }
  .gameover .line {
    transform: perspective(100rem) rotateZ(45deg);
  }

  .finish {
    align-items: center;
    align-content: center;
    background-color: black;
    bottom: -120px;
    color: white;
    cursor: default;
    display: flex;
    opacity: 0;
    font-size: 16px;
    flex-wrap: wrap;
    height: 120px;
    justify-content: center;
    position: absolute;
    pointer-events: none;
    text-align: center;
    width: 100%;
    z-index: 10;
  }
  .finish:hover {
    display: flex;
    opaci.........完整代码请登录后点击上方下载按钮下载查看

网友评论0