我尝试了几种不同的方法,但我似乎无法弄清楚如何在不包含文本输入的不透明度的情况下更改占位符的不透明度。
代码如下:
<label for="CI_company-organization-input" class="col-lg-10 col-form-label" style="margin-top: 5px;" required>Company/Organization</label>
<div class="col-lg-8">
<input class="form-control" type="text" id="CI_company-organization-input" placeholder="Ex: GreyBar">
</div>
我想将占位符的不透明度设置为 0.5,但将文本输入设置为正常的不透明度。我试过在占位符属性之后放置一个样式标签,但所有这些都会使输入文本的不透明度也变为 0.5 不透明度。
这可能吗?
最佳答案
您可能想尝试一下,如果有效请告诉我?
input.form-control::placeholder {
opacity: .5;
}
关于html - 在 Bootstrap 中更改表单字段不透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50821565/