【发布时间】:2020-10-07 01:24:21
【问题描述】:
在我正在制作的网站中,我将输入元素的占位符属性设置为向上翻译。我想知道即使在元素中输入文本后是否可以保持占位符属性相同。
这是我的 CSS
.inputbox {
height: 40px;
padding-top: 5px;
border-style: none none double none;
border-color: rgb(117, 117, 117);
width: 200px;
outline: none;
transition: border-color 0.3s;
}
.inputbox:focus {
border-color: #111;
}
.inputbox::placeholder {
transition: all 0.3s;
}
.inputbox:focus::placeholder {
transform: translateY(-20px);
color: #111;
transition: all 0.3s;
}
【问题讨论】:
-
“相同”是什么意思,输入值后占位符值不应该消失吗?请详细说明。
-
是的,确实如此。我想知道在元素中输入一些输入后是否可以防止占位符消失。
-
会不会使输入的文本难以理解,因为它会与占位符重叠?
-
我使用 css 将其向上移动,使其不会重叠
标签: javascript html css placeholder