html - 我该如何修复这个 css 左对齐?

标签 html css alignment

我把每个选项都做成了一个容器,所以我有 8 个容器,从左到右,从上到下。

但由于某些未知原因,item_container 3 和 4 没有对齐!!我在这上面花了几个小时,但没有用。现在很沮丧。

enter image description here

这是我的 html 代码。 item_container 5~8和1,2基本一样,而且对齐的很完美,所以没有包含。

.page_item {
	display: inline-block;
	margin-left: 28px;
	margin-right: 8px;
	margin-bottom: 1px;
}

.page_field {
	display: inline-block;
	margin-right: 68px;
	margin-bottom: 1px;
}

.page_check_field {
	display: inline-block;
	margin-right: 8px;
	margin-bottom: 1px;
}

.page_container {
	display: block;
	width: 876px;
	height: 74px;
}

.page_container .item_container1, .page_container .item_container2, .page_container .item_container3, .page_container .item_container4, .page_container .item_container5, .page_container .item_container6, .page_container .item_container7, .page_container .item_container8 {
	display: inline-block;
}

.item_container1, .item_container2, .item_container3 .item_container4, .item_container5, .item_container6, .item_container7, .item_container8 {
	display: inline-block;
	width: 436px;
}
<div class="page_container">
			<div class="item_container1">
				<h6 class="page_item">User ID</h6>
				<div class="page_field form-group form-group-label">
					<label class="page_entry floating-label" for="..."> Entry User ID </label>
					<input class="form-control" id="..." type="text">
				</div>
			</div>
			<div class="item_container2">	
				<h6 class="page_item">Country</h6>
				<div class="page_field form-group form-group-label">
					<select class="page_entry form-control" id="...">
						<option value="..."> Select </option>
						<option value="..."> Country 1 </option>
						<option value="..."> Country 2 </option>
						<option value="..."> Country 3 </option>
						<option value="..."> Country 4 </option>
						<option value="..."> Country 5 </option>
						<option value="..."> Country that has very long name </option>
					</select>
				</div>
			</div>
		</div>
		
		<div class="page_container">
			<div class="item_container3">
				<h6 class="page_item">Email</h6>
				<div class="page_field form-group form-group-label">
					<label class="floating-label" for="..."> Entry User Email </label>
					<input class="form-control" id="..." type="text">
				</div>
			</div>
			<div class="item_container4">
				<h6 class="page_item">User Type</h6>
				<div class="page_check_field">
					<div class="checkbox checkbox-adv">
						<label for="check1">
						<input class="access-hide" id="check1" name="check1" type="checkbox">Cosplayer
						<span class="checkbox-circle"></span>
						<span class="checkbox-circle-check"></span>
						<span class="checkbox-circle-icon icon">done</span>
						</label>
					</div>
				</div>
				<div class="page_check_field">
					<div class="checkbox checkbox-adv">
						<label for="check2">
						<input class="access-hide" id="check2" name="check2" type="checkbox">Cameraman
						<span class="checkbox-circle"></span>
						<span class="checkbox-circle-check"></span>
						<span class="checkbox-circle-icon icon">done</span>
						</label>
					</div>
				</div>
				<div class="page_check_field">
					<div class="checkbox checkbox-adv">
						<label for="check3">
						<input class="access-hide" id="check3" name="check3" type="checkbox">Organizer
						<span class="checkbox-circle"></span>
						<span class="checkbox-circle-check"></span>
						<span class="checkbox-circle-icon icon">done</span>
						</label>
					</div>
				</div>
			</div>
		</div>

最佳答案

此行中缺少一个逗号,这可能是您遇到问题的原因

.item_container2, .item_container3 .item_container4,

关于html - 我该如何修复这个 css 左对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37877571/

相关文章:

Jquery 自动完成对齐

javascript - 将星号附加到包含类为 .mandatory 的标签的 div 的兄弟项

css - 在 div 中心顶部对齐文本

html - Chrome 中的 CSS 网格布局似乎无法在超过 1000 行的情况下正常工作

html - 使用属性在 HTML 中定位链接

html - 我能找到在 html5 中创建自己的标签的解决方案吗?我的标签必须在 w3c 中验证

jquery - 复杂的 jQuery .hover 工作

html - CSS 对齐小 Div block

javascript - bootstrap 2 插件与 bootstrap 3 标记的兼容性如何

HTML:如何仅使用其十六进制表示来显示图像