html - 为什么我的 bootstrap inputs 比他们的 parent div 大

标签 html css twitter-bootstrap-3

您好,我正在尝试做一个简单的登录站点,但我在 Bootstrap 方面遇到了一些问题。我正在尝试在我的网站中心做一个简单的 div,但问题是当我添加两个以上的输入时,输入不会缩放并且它们比 div 大。问题出在较小的屏幕上。 这是 html 代码:

<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
		<link rel="stylesheet" type="text/css" href="style.css">
	</head>
	<body>
		<div class='container'>
			<form id='login'>
				<div class='form-group row'>
					<label for='email' class='col-form-label'></label>
					<div class="col-sm-offset-4 col-sm-4">
						<input type="email" id='login' class='form-control' placeholder="login">
					</div>
				</div>
				<div class='form-group row'>
					<label for='password' class='col-form-label'></label>
					<div class="col-sm-offset-4 col-sm-4">
						<input type="password" class='form-control' id='password' placeholder="password">
					</div>
				</div>
			</form>
		</div>
	</body>
</html>

这是我的 CSS 代码:

body {
	background-color: #ffffff;
	height: 100vh;
}
.container {
	background-color: #3b5f83;
	position: relative;
	top: 40%;
	height: 20%;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
#login {
	max-height: 60%;
}

感谢帮助

最佳答案

尺寸 sm 不是最小的移动 View 。

替换

的所有实例
    col-sm-offset-4 col-sm-4

    col-xs-offset-4 col-xs-4

并且您的输入将保留在较小尺寸的元素中

关于html - 为什么我的 bootstrap inputs 比他们的 parent div 大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43879054/

相关文章:

html - 自动加载甚至没有链接的 css 文件

html - 如何对齐BUTTON的文字中间

css - 使用 Bootstrap 时如何使图标变小?

html - Bootstrap 3 嵌套行宽

html - selectOneListBox 大小为 1 显示为下拉菜单

html - 正则表达式:匹配不在 HTML 标记内的特定字符串

javascript - anchor 标签不起作用?

css - 有没有办法将我的样式用作 react 中的外部 css 文件?

css - Bootstrap 3 导航栏更改颜色导致显示白色边框或白线

image - 带有来自缩略图的完整图像的弹出窗口