是否可以在不增加第一个盒子高度的情况下移除第一个透明边框?我最初尝试使用边距,但由于百分比的使用,这不起作用。这就是我所拥有的 - http://jsfiddle.net/KCbgM/1/
更新:我要删除的边框已经是透明的 - 第一个框的左边框。我试图在第一个孩子面前让盒子适应100%没有间隙 - 现在是使用'.grid ul li .grid-item'类的透明边框。
HTML:
<div class="grid">
<ul>
<li>
<div class="grid-item grid-five">
<div class="grid-person-wrapper">
<img class="grid-person-mug" src="http://boardingarea.wpengine.netdna-cdn.com/deltapoints/files/2012/07/test.jpg">
</div>
</div>
</li>
<li>
<div class="grid-item grid-five">
<div class="grid-person-wrapper">
<img class="grid-person-mug" src="http://boardingarea.wpengine.netdna-cdn.com/deltapoints/files/2012/07/test.jpg">
</div>
</div>
</li>
<li>
<div class="grid-item grid-five">
<div class="grid-person-wrapper">
<img class="grid-person-mug" src="http://boardingarea.wpengine.netdna-cdn.com/deltapoints/files/2012/07/test.jpg">
</div>
</div>
</li>
<li>
<div class="grid-item grid-five">
<div class="grid-person-wrapper">
<img class="grid-person-mug" src="http://boardingarea.wpengine.netdna-cdn.com/deltapoints/files/2012/07/test.jpg">
</div>
</div>
</li>
<li>
<div class="grid-item grid-five">
<div class="grid-person-wrapper">
<img class="grid-person-mug" src="http://boardingarea.wpengine.netdna-cdn.com/deltapoints/files/2012/07/test.jpg">
</div>
</div>
</li>
</ul>
</div>
CSS:
.grid {
display: block;
float: left;
border:1px solid #000;
}
.grid ul {
list-style: none;
margin: 0;
padding: 0;
}
.grid ul li {
display: inline;
text-align: -webkit-match-parent;
}
.grid-five {
width: 20%;
}
.grid-item {
float: left;
display: block;
background: transparent;
position: relative;
overflow: hidden;
}
.grid ul li .grid-item {
border-left: 34px solid transparent;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.grid ul li:first-child .grid-item {
margin-left:0px;
}
.grid-person-wrapper {
border: 8px solid #cad7c5;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
float: left;
position: relative;
z-index: 1;
width: 100%;
cursor: pointer;
display: block;
-webkit-transition: All 0.1s ease;
-moz-transition: All 0.1s ease;
-o-transition: All 0.1s ease;
-ms-transition: All 0.1s ease;
transition: All 0.1s ease;
}
.grid-person-wrapper:hover {
border: 8px solid #a9f001;
opacity: 0.8;
}
.grid-person-mug {
width: 100%;
border: none;
max-width: 100%;
}
答案 0 :(得分:3)
删除透明边框,改为在列表中设置text-align:justify;
并使用伪元素将内容拉伸到100%宽度:
<强> FIDDLE 强>
.grid ul {
list-style: none;
margin: 0;
padding: 0;
text-align:justify;
}
.grid ul:after {
content: '';
width: 100%;
display: inline-block;
}
.grid ul li {
display: inline;
}
.grid-five {
width: 18%;
}
答案 1 :(得分:1)
你可以试试这个......
.grid ul li:first-child .grid-person-wrapper
{
border-left:transparent;
}
如果您的要求不同,请告诉我..
祝你好运...... :)
答案 2 :(得分:0)
<德尔>尝试:德尔>
.grid ul li .grid-item {
padding-left:34px;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
<德尔>} 德尔>
编辑:
好的,现在我看到了这个问题。
这应该可以解决问题:
.grid ul li:first-child .grid-item {
margin-left:-34px;
}
答案 3 :(得分:0)
您还需要解决width
更改问题。试试:
.grid ul li:first-child .grid-item {
border-left: none;
width: 15%;
}
小提琴:http://jsfiddle.net/KCbgM/5/
编辑1:
如何更改divs
与变体帐户之间的差距?
.grid ul li .grid-item {
-moz-box-sizing: border-box;
border-left: 34px solid rgba(0, 0, 0, 0);
margin-left: 1.25%;
}
.grid ul li:first-child .grid-item {
border-left: medium none;
margin-left: 0;
width: 15%;
}
小提琴:http://jsfiddle.net/KCbgM/6/
如果这是你想要的,请告诉我。