z-index要和定位连用但是当我加相对定位和绝对定位的时候某些效果又消失了求解?
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>Documenttitle>
<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>