删除画廊框上的最右边距

时间:2014-10-17 21:16:13

标签: html css css3 gallery

请你帮我从我的盒子里取下最右边的边缘? 我试图在CSS中使用::after伪元素,但它似乎不起作用。 (http://jsfiddle.net/ve0Laa8f/

<div class="content-wrap">
<div class="content-center-wrap">
<div class="index-cats-wrap"></div>
<div class="index-cats-wrap"></div>
<div class="index-cats-wrap"><p>test</div>
</div>  
</div>  

.content-center-wrap{
    width:960px;
    height:auto;
    min-height:400px;
    overflow:hidden;
    background-color:#fff;
    margin: 0 auto;
    padding-top:40px;
    padding-bottom:40px;
}

.index-cats-wrap{
    display:block;
    float:left;
    width:298px;
    height:400px;
    margin-right:20px;
    border:1px solid #95a5a6;
}

.index-cats-wrap::after{
    margin-right:0px;
}

感谢。

1 个答案:

答案 0 :(得分:1)

您需要:last-child css选择器。

.index-cats-wrap:last-child {
  margin-right: 0px;
}

小提琴:http://jsfiddle.net/ve0Laa8f/5/

相关问题