gpt4 book ai didi

css - 从第一个 child 删除边框

转载 作者:太空宇宙 更新时间:2023-11-03 21:44:13 25 4
gpt4 key购买 nike

是否可以在不增加第一个框的高度的情况下移除第一个透明的 border-left?我最初尝试使用边距,但由于使用百分比,这无法工作。这是我的 - http://jsfiddle.net/KCbgM/1/

更新:我要删除的边框已经是透明的 - 第一个框的左边框。我试图让盒子在第一个 child 之前 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%;
}

最佳答案

移除透明边框,改为在列表中设置 text-align:justify; 并使用伪元素将内容拉伸(stretch)到 100% 宽度:

FIDDLE

(相关)CSS

.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%;
}

关于css - 从第一个 child 删除边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21529911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com