With absolute positioning, you've broken free of the parent box. Adding position: relative;
to the input-div
element, or changing the label
to position relative;
may help you position the label in relation to input-div
.
.form .input-div {
position: relative;
}
.form .input-div label {
position: absolute;
top: 0;
left: 0;
width: 100%; /* Set width to something appropriate */
height: 30px; /* Set this value to something appropriate */
display: table; /* Optional. May help set an organic line width */
padding: 10px 0;
font-size: 1rem;
pointer-events: none;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…