CSS输入框动效

在这里插入图片描述

<div class="input-box">
    <input type="text" required />
    <span>your name</span>
</div>
.input-box {
        position: relative;
        width: 200px;
        input {
            width: 100%;
            padding: 10px;
            border: 1px solid plum;
            border-radius: 5px;
            font-size: 1em;
            outline: none;
            &:valid~span,
            &:focus~span {
                color: aqua;
                transform: translateX(10px) translateY(-12px);
                padding: 0 10px;
                background-color: #fff;
            }
        }
        span {
            position: absolute;
            left: 0;
            top: 0;
            padding: 10px;
            font-size: 1em;
            pointer-events: none;
            columns: #ccc;
            transition: all 0.5s;
        }
}

相关推荐

  1. css鼠标悬浮

    2024-05-11 08:26:06       51 阅读
  2. css实现文字下划线

    2024-05-11 08:26:06       64 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-11 08:26:06       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-11 08:26:06       100 阅读
  3. 在Django里面运行非项目文件

    2024-05-11 08:26:06       82 阅读
  4. Python语言-面向对象

    2024-05-11 08:26:06       91 阅读

热门阅读

  1. 超级好用的C++实用库之动态库加载器

    2024-05-11 08:26:06       27 阅读
  2. axios常用配置

    2024-05-11 08:26:06       33 阅读
  3. npm详解

    2024-05-11 08:26:06       28 阅读
  4. 【服务治理中间件】consul介绍和基本原理

    2024-05-11 08:26:06       33 阅读
  5. Express中间件(完善)

    2024-05-11 08:26:06       31 阅读
  6. VUE----数字增加,兼容小程序

    2024-05-11 08:26:06       31 阅读
  7. Android Gradle的插件

    2024-05-11 08:26:06       28 阅读
  8. sass 详解

    2024-05-11 08:26:06       40 阅读
  9. 人工智能对企业安全的影响与风险控制-内刊

    2024-05-11 08:26:06       25 阅读
  10. Oracle行锁怎么杀

    2024-05-11 08:26:06       27 阅读
  11. rviz与urdf

    2024-05-11 08:26:06       31 阅读