我想摆脱DIV 1的左侧填充和DIV 2的右侧填充,以便将中间的2个div分开。我想要 。请注意我没有使用Bootstrap。 (请参见图1)
这是我的HTML代码:
<div class="row">
<div class="col-50">
<div class="card-box">
<h4 class="header-title">View Data</h4>
<div class="col-100">
<div class="row">
<div class="col-50">
<div class="btn-group">
<a class="btn-excel" href="#"><span>Excel</span></a>
<a class="btn-pdf" href="#"><span>PDF</span></a>
</div>
</div>
<div class="col-50">
<form class="pull-right">
<input type="text" placeholder="Search..." class="form-control">
<span><i class="fa fa-search"></i></span>
</form>
</div>
</div>
<div class="row">
<div class="col-100">
</div>
</div>
</div>
</div>
</div>
<div class="col-50">
<div class="card-box">
<h4 class="header-title">View Data</h4>
<div class="table-container">
<div class="row">
<div class="col-50">
<div class="btn-group">
<a class="btn-excel" href="#"><span>Excel</span></a>
<a class="btn-pdf" href="#"><span>PDF</span></a>
</div>
</div>
<div class="col-50">
<form class="pull-right">
<input type="text" placeholder="Search..." class="form-control">
<span><i class="fa fa-search"></i></span>
</form>
</div>
</div>
<div class="row">
<div class="col-100">
</div>
</div>
</div>
</div>
</div>
</div>
这是我的CSS代码:
*, *::before, *::after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.row::after {
content: "";
display: table;
clear: both;
}
.row {
margin-left: -0.75rem !important;
margin-right: -0.75rem !important;
}
.col-50 {
width: 50%;
float: left;
position: relative;
min-height: 1px;
padding-left: 0.75rem;
padding-right: 0.75rem;
}
.card-box {
padding: 5px 20px 20px 20px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-border-radius: 5px;
background-clip: padding-box;
margin-top: 15px;
margin-bottom: 20px;
background-color: #ffffff;
box-shadow: 0 0px 24px 0 rgba(0, 0, 0, 0.06), 0 1px 0px 0 rgba(0, 0, 0, 0.02);
display: block;
min-height: 0.01%;
overflow-x: auto;
}
答案 0 :(得分:0)
使用sudo apt-get install libfontconfig
和first-of-type
选择器选择第一列和最后一列,然后删除第一列的左边距和最后一列的右边边,如下所示:
last-of-type
班级.col-50:first-of-type {
padding-left: 0rem;
}
.col-50:last-of-type {
padding-right: 0rem;
}
已经有.col-50
和padding-left: 0.75rem;
,这会在列之间添加相等的间距,因此无需编辑此内容。
padding-right: 0.75rem;
以下是工作的代码集示例:Trouble connecting to phantomJs webdriver using python and selenium