我是 CSS 新手,我正在使用 Bootstrap,我想以 2 种方式使用表单:表单字段周围有无边框。我怎样才能做到最好?这是我要删除边框的 Bootstrap 表单示例:plnkr.co/edit/xxx1Wy4kyCESNsChK4Ra?p=preview。
出于好奇,我想要这个的原因是我想首先向用户显示他拥有的数据,然后根据表单是否处于“编辑”模式来切换显示边框。用户可以通过单击“编辑”链接进入“编辑”模式,或者只是开始编辑字段。
最佳答案
在该示例中,要删除边框,只需编写:
.form-control {
border: 0;
}
在您的 CSS 文件中。
不过,这将从所有表单字段中删除边框,更灵活的方法是将一个类附加到您希望没有边框的表单字段,因此您的 HTML 将类似于:
<input type="email" class="form-control no-border" id="inputEmail3" placeholder="Email">
和你的 CSS:
.no-border {
border: 0;
box-shadow: none; /* You may want to include this as bootstrap applies these styles too */
}
关于twitter-bootstrap - Bootstrap : Remove form field border,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26033426/