虚拟键盘效果

代码语言:html

所属分类:布局界面

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


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

<style>
@import url("https://fonts.googleapis.com/css?family=Ubuntu:500&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Ubuntu', sans-serif;
}

body {
  background: #F2F7FB;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  flex-direction: column;
}
.container__content {
  width: 60%;
}

.textbox {
  width: 100%;
  resize: none;
  background: linear-gradient(145deg, #F2F7FB, #E9F2FB);
  box-shadow: inset 8px 8px 15px #D9E3EC;
  border-radius: 12px;
  border: none;
  overflow: auto;
  padding: 20px;
  outline: none;
  margin: 50px 0;
}

.keyboard {
  padding: 25px;
  background: linear-gradient(145deg, #F2F7FB, #E9F2FB);
  box-shadow: 8px 8px 15px #D9E3EC;
  border-radius: 12px;
  min-width: 750px;
  max-width: 1000px;
}
.keyboard__keys {
  display: flex;
  justify-content: center;
}

.key {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  margin: 10px;
  min-width: 50px;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(145deg, #F2F7FB, #E9F2FB);
  box-shadow: 5px 5px 15px #D9E3EC;
}
.key__letter {
  background: -webkit-linear-gradient(245deg, #1E71F5, #3CDEE7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.key__down {
  color: linear-gradient(45deg, #1E71F5, #3CDEE7);
  background: linear-gradient(145deg, #E9F2FB, #F2F7FB);
  box-shadow: inset 5px 5px 5px #D9E3EC;
}
.key__space {
  width: 60%;
}
</style>

</head>
<body translate="no">
<div class="container">
<div class="textbox__container">
<textarea autofocus name="textbox" cols="128" rows="10" class="textbox" placeholder="按下你的实体键盘,看看屏幕上的键盘反应"></textarea>
</div>
<div class="container__content">
<div class="keyboard">
<div class="keyboard__row">
<div class="keyboard__keys">
<span class="key"><p class="key__letter">Q</p></span>
<span class="key"><p class="key__letter">W</p></span>
<span class="key"><p class="key__letter">E</p></span>
<span class="key"><p class="key__letter">R</p></span>
<span class="key"><p class="key__letter">T</p></span>
<span class="key"><p class="key__letter">Y</p></span>
<span class="key"><p class="key__letter">U</p></span>
<span class="key"><p class="key__letter">I</p></span>
<span class="key"><p class="key__letter">O</p></span>
<span class="key"><p class="key__letter">P</p></span>
</div>
</div>
<div class="keyboard__row">
<div class="keyboard__keys">
<span class="key"><p class="key__letter">A</p></span>
<span class="key"><p class="key__letter">S</p></span>
<span class="key"><p class="key__letter">D</p></span>
<span class="key"><p class="key__letter">F</p></span>
<span class="key"><p class="key__letter">G</p></span>
<span class="key"><p class="key__letter">H</p></span>
<span class="key"><p class="key__letter">J</p></span>
<span class="key"><p class="key__letter">K</p></span>
<span class="key"><p class="key__letter">L</p></span>
</div>
</div>
<div class="keyboard__row">
<div class="keyboard__keys">
<span class="key"><p class="key__letter">Z</p></span>
<span class="key"><p class="key__letter">X</p></span>
<span class="key"><p class="key__letter">C</p></span>
<span class="key"><p class="key__letter">V</p></span>
<span class="key"><p class="key__letter">B</p></span>
<span class="key"><p class="key__letter">N.........完整代码请登录后点击上方下载按钮下载查看

网友评论0