Satrol_ 2022-11-12 09:11 采纳率: 100%
浏览 22
已结题

如何如何做到加定位实现输入的内容不被过渡的小i覆盖

z-index要和定位连用但是当我加相对定位和绝对定位的时候某些效果又消失了求解?

img


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .input_Box {
            position: relative;
            width: 400px;
            margin: 100px auto 0;
            background-color: aqua;
        }
        .input_Box input {
            border: 0;
            width: 100px;
            height: 30px;
            outline: none;
            z-index: 9;
        }
        i {
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100px;
            height: 1px;
            background-color: aqua;
            transition: 0.6s;
            
        }
        input:focus~i {
            position: absolute;
            height: 30px;
            z-index: 1;
        }
    </style>
</head>
<body>
    <div class="input_Box">
        <input type="text">
        <i></i>
    </div>
    
</body>
</html>
  • 写回答

1条回答 默认 最新

  • 经海路大白狗 领域专家: 前端开发技术领域 2022-11-12 09:35
    关注

    img


    我看了半天没明白你要实现什么效果?
    私聊吧

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 10月27日
  • 已采纳回答 10月19日
  • 创建了问题 11月12日