twitter-bootstrap - 引导输入字段方角错误
问题描述
我正在使用注册表构建网站(使用 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' 之前,验证不会出现,但即便如此,右角仍然是平方的。
我在某个地方犯了错误还是这是一个错误?
解决方案
这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>
推荐阅读
- javascript - 会话断开后重新连接到 Laravel Echo 服务器
- python - 需要从一个函数中创建一个列表
- javascript - page.type() 内 page.evaluate()
- amazon-web-services - AWS CLI 生成一个文本文件?
- java - 为什么在 Thread 中使用 map 来存储 ThreadLocal 对象?
- python - 使用format方法修改student_grade函数,
- python - Tensoflow Keras - 具有 sparse_categorical_crossentropy 的 Nan 损失
- python-3.x - 如何在python中自动化曲线拟合过程?
- java - 无法在 Java Selenium Headless 浏览器的新窗口中捕获文本
- android - 为什么我的视频在 Android 的某些设备中播放 Anti roitation 是统一构建的