我正在使用注册表创建网站(使用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”后,验证才会出现,但即使如此,右角仍保持正方形。
我在某个地方犯了错误还是这是一个错误?
答案 0 :(得分:0)
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>