是否可以使输入元素的占位符属性在输入值后保持不变

Is it possible to make the placeholder attribute of an input element remain the same even after entering a value

在我制作的网站中,我将输入元素的占位符属性设置为向上翻译。我想知道即使在元素中输入文本后是否可以保持占位符属性相同。

这是我的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;
}

我认为输入一些文本后不可能保留占位符属性。我能解决的最好方法是使用 <label> 标签。