首页 > 解决方案 > Bootstrap中带有一个边框的多个输入元素

问题描述

[更新/已解决]

我正在尝试在引导程序中的表单组内的多个输入之间设置一个边框,但该边框仅在没有焦点和最后一个输入时才有效。我的期望边界工作既集中又不集中。

.container{
margin-top:20px;
width:80%;
}
.input-merge [class*="col-"]{
padding:0;
}

.form-control{
border-radius:0 !important;
}

.form-control:focus {
 position: relative;
 z-index: 1;
}

.input-merge div:not(:first-child) {
    margin-left: -1px;
}
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
</head>

<body>
<div class="container">
<div class="form-group input-merge">
   <div class="col-xs-4">
      <input type="text"  class="form-control" placeholder="Input One">
   </div>
   <div class="col-xs-4">
      <input type="text"  class="form-control" placeholder="Input Two">
    </div>
    <div class="col-xs-4">
      <input type="text"  class="form-control" placeholder="Input Three">
    </div>
   </div>
</div>
</body>

如何解决?谢谢。

标签: javascriptjqueryhtmlcsstwitter-bootstrap-3

解决方案


您可以将以下内容添加到您的 CSS;

.form-control:focus { position: relative; z-index: 1; }

它将重点输入置于其他输入之上。因此焦点轮廓(发光)将完全可见。


推荐阅读