如何使用CSS删除框的底部边框

时间:2010-11-06 18:37:56

标签: css border

alt text

我有一个矩形div,就像上面那个。我想删除div中的底部边框(从C到D)。我怎么能这样做?。

编辑:这是我的CSS:

#index-03 {
  position: absolute;
  border: .1px solid #900;
  border-width: .1px;
  border-style: solid;
  border-color: #900;
  left: 0px;
  top: 102px;
  width: 900px;
  height: 27px;
}
<div id="index-03" 
     style="background-color:limegreen; width:300px; height:75px;">
</div>

4 个答案:

答案 0 :(得分:49)

只需加入:border-bottom: none;

#index-03 {
    position:absolute;
    border: .1px solid #900;
    border-bottom: none;
    left:0px;
    top:102px;
    width:900px;
    height:27px;
}

答案 1 :(得分:2)

你似乎误解了盒子模型 - 在CSS中你提供了顶部和左边的点,然后是宽度和高度 - 这些都是一个盒子放置精确测量所需要的。

width属性是C-D的属性,但它也是A-B的属性。如果省略它,div将没有定义的宽度,宽度将由其内容定义。


更新(关于问题的评论:

在CSS中添加border-bottom-style: none;,仅从底部删除此样式。

答案 2 :(得分:0)

您可以将宽度设置为自动。然后,如果没有内容,div的宽度将等于0。

width:auto;

答案 3 :(得分:0)

您可以设置

libboost_filesystem.so

border-bottom: none;

一个将border-bottom: 0; 设置为border-style
可以将none设置为border-width

0px
div {
  border: 3px solid #900;

  background-color: limegreen; 
  width:  28vw;
  height: 10vw;
  margin:  1vw;
  text-align: center;
  float: left;
}

.stylenone {
  border-bottom: none;
}
.widthzero {
  border-bottom: 0;
}

侧面说明:
如果您必须找出为什么边框在预期的时间不显示, 很高兴知道这两个都是罪魁祸首。 另外,请验证<div> (full border) </div> <div class="stylenone"> (style)<br><br> border-bottom: none; </div> <div class="widthzero"> (width)<br><br> border-bottom: 0; </div>border-color是不同的。