【问题标题】:TextBox in Bootstrap 5Bootstrap 5 中的文本框
【发布时间】:2020-06-25 11:41:24
【问题描述】:
有人可以帮助我使用 Bootstrap 5 或仅使用平面 css 类文本框设计下面的文本框吗
文本框应该是响应式的
OnPage 加载文本框应带有占位符
<div class="form-outline">
<input type="text" id="form1" class="form-control" />
<label class="form-label" for="form1">Example label</label>
</div>
在文本框上单击它的标签应该向上
【问题讨论】:
标签:
javascript
jquery
css
twitter-bootstrap
【解决方案1】:
关注thiscodepen:
::-webkit-input-placeholder {
direction: rtl;
}
fieldset.form-group {
position: relative;
}
label {
position: absolute;
top: .6rem;
left: 1rem;
transition: all .1s ease-in-out;
cursor: text;
}
:focus + label {
color: #66afe9;
top: -.9rem;
background: white;
}
<fieldset class="form-group">
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
<label for="exampleInputEmail1">Email address</label>
<small class="text-muted">We'll never share your email with anyone else.</small>
</fieldset>