通过CSS删除最后一个Child div的右边框

时间:2013-10-22 18:12:36

标签: html5 css3 css-selectors

我与我的孩子div有正确的边框,但我想从最后一个div中删除右边框。

这是HTML

         <div class="nav-footer">

            <div class="col-lg-2">
              <h2 class="light-blue">Who</h2>
              <p class="white">are the people/ would you drink with</p>
            </div>
            <div class="col-lg-2">
              <h2 class="light-blue">Where</h2>
              <p class="white">would be having a hangover</p>
           </div>
            <div class="col-lg-2">
              <h2 class="light-blue">What</h2>
              <p class="white">would you be working on</p>
            </div>
             <div class="col-lg-2">
              <h2 class="light-blue">How</h2>
              <p class="white">does a team drink</p>
            </div>
             <div class="col-lg-2">
              <h2 class="light-blue">Why</h2>
              <p class="white">should you drink</p>
            </div>
             <div class="col-lg-2">
              <h2 class="light-blue">Show</h2>
              <p class="white">at Vegas</p>
            </div>
        </div>

CSS

.nav-footer .col-lg-2       { border-right: 1px solid #ffffff;}
.nav-footer .col-lg-2 .last { border-right:none; }

它不像那样......

感谢。

1 个答案:

答案 0 :(得分:3)

我相信您打算使用:last-child选择器:

.nav-footer .col-lg-2:last-child

jsFiddle example here.