【发布时间】:2022-01-11 03:39:33
【问题描述】:
为什么输入框下面看不到边框?
此外,按钮越过边框,边框对于它旁边的按钮是连续的,但对于输入字段不是。
我的 CSS
input,
button {
display: block;
position: relative;
width: 300px;
margin: auto;
cursor: pointer;
border: 0;
height: 60px;
outline: 0;
}
input {
border-radius: 10px 0 0 10px;
}
button {
width: 100px;
}
input:after {
border-radius: 10px 0 0 10px;
}
input:after,
button:after {
transition: 200ms all ease;
background-color: #fcfcfc;
border: 1px solid #afafaf;
line-height: 60px;
color: #252525;
font-size: 1.5em;
text-align: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: inline-block;
content: "Select package.json";
}
button:after {
content: "Upload";
border-radius: 0px 10px 10px 0;
}
input:hover:after,
button:hover:after {
background-color: #f1f1f1;
}
【问题讨论】:
-
您能否添加 html 并检查给定的 scss,因为我没有得到与您相同的输出。您已将标签指定为 sass,但它应该是 scss。
-
注意输入元素不能附加伪元素。