【问题标题】:Bootstrap input field square corners bug引导输入字段方角错误
【发布时间】:2019-04-18 14:45:13
【问题描述】:

我正在使用注册表构建网站(使用 Bootstrap);应用验证反馈 div 时,每个输入字段的右侧角显示为方形,而不是像左侧那样圆润。

这方面的一个例子可以在这里看到:https://codepen.io/anon/pen/RqVeoL

以下:

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
    Why does the following input field have rounded corners on the left but square corners on the right?
    <form>
      <div class="input-group">
        <input class="form-control">
        <div class="valid-feedback">
          Pass!
        </div>
        <div class="invalid-feedback">
          Fail!
        </div>
      </div>
    </form>
    This is only the case when specifying valid and invalid feedback divs...
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  </body>
</html>

当然,只有在输入类中指定了 'is-valid' 或 'is-invalid' 之后才会出现验证,但即便如此,右上角仍然是正方形的。

我是在某处犯了错误还是这是一个错误?

【问题讨论】:

    标签: twitter-bootstrap bootstrap-4


    【解决方案1】:

    input-group 意味着右侧有一个按钮/附加组件。对于简单的输入,只需使用form-group...

      <div class="form-group">
        <input class="form-control">
        <div class="valid-feedback">
          Pass!
        </div>
        <div class="invalid-feedback">
          Fail!
        </div>
      </div>
    

    https://www.codeply.com/go/o9HXbU3VpC

    【讨论】:

      猜你喜欢
      • 2014-08-16
      • 2019-11-24
      • 2016-07-18
      • 1970-01-01
      • 2019-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-06
      相关资源
      最近更新 更多