div+css实现带阴影输入框聚焦效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现带阴影输入框聚焦效果代码

代码标签: div css 阴影 输入框 聚焦

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

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

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

  
  
<style>
body{
    margin: 100px;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

.input-sizer {
  display: inline-grid;
  vertical-align: top;
  align-items: center;
  position: relative;
  border: solid 1px;
  padding: 0.25em 0.5em;
  margin: 5px;
}
.input-sizer.stacked {
  padding: 0.5em;
  align-items: stretch;
}
.input-sizer.stacked::after,
.input-sizer.stacked input,
.input-sizer.stacked textarea {
  grid-area: 2/1;
}
.input-sizer::after,
.input-sizer input,
.input-sizer textarea {
  width: auto;
  min-width: 1em;
  grid-area: 1/2;
  font: inherit;
  padding: 0.25em;
  margin: 0;
  resize: none;
  background: none;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  border: none;
}
.input-sizer span {
  padding: 0.25em;
}
.input-sizer::after {
  content: attr(data-value) " ";
  visibility: hidden;
  white-space: pre-wrap;
}
.input-sizer:focus-within {
  outline: solid 1px blue;
  box-shadow: 4px 4px 0px blue;
}
.input-sizer:focus-within > span {
  color: blue;
}
.input-sizer:focus-within textarea.........完整代码请登录后点击上方下载按钮下载查看

网友评论0