js+svg实现输入框自定义长颈鹿光标效果代码

代码语言:html

所属分类:表单美化

代码描述:js+svg实现输入框自定义长颈鹿光标效果代码

代码标签: js svg 输入框 自定义 长颈鹿 光标

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

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

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


  
  
  
  
<style>
* {
  box-sizing: border-box;
}

body,
input {
  font-family: "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif;
}
body::selection,
input::selection {
  background-color: #feeaa7;
  color: #8a5836;
}

body {
  padding: 40px 20px;
  background: #ffeaa7;
}

.giraffe {
  width: 100%;
  max-width: 400px;
  position: relative;
  margin: 0 auto;
}

.giraffe-input {
  background: #fcfef4;
  outline: none;
  caret-color: transparent;
}

.giraffe-input,
.giraffe-clone {
  border: 1px solid #ddd;
  display: block;
  padding: 30px 39px;
  font-size: 30px;
  width: 100%;
}

.giraffe-input:focus {
  border-color: #999;
}

.giraffe-clone {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding-right: 0;
  display: flex;
  pointer-events: none;
  border-color: transparent;
  color: transparent;
}

.giraffe-content {
  white-space: nowrap;
}

.giraffe-padding {
  flex: 30px 0 0;
  height: 100%;
  min-height: 1em;
}

.giraffe--caret-visible .giraffe-caret {
  opacity: 1;
}

@keyframes blink {
  100% {
    transform: translateX(-100%);
  }
}
.giraffe-caret {
  display: inline-block;
  transform: translate(-33px, -12px);
  opacity: 0;
  transition: opacity 100ms;
  position: relative;
  width: 50px;
  overflow: hidden;
}
.giraffe-caret svg {
  anima.........完整代码请登录后点击上方下载按钮下载查看

网友评论0