将水平列表放在div的底部边界

时间:2012-10-14 22:05:06

标签: css html

我在div的结束标记之前有一个水平无序列表。名单放在边界。现在我尝试将border-bottom: 1.5px solid #b9b7b7;添加到div中,列表只是从边界向上移动,就好像div底边框和列表之间有填充,但是我的css中没有这样的填充。如何将底部边框添加到父div并将最后一个子元素放在父div的底部边界处?

修改  HTML

<div id="banner"><img src="images/banner.gif" width="450px" height="80px" alt="parul library" />
 <div id="navigation_panel">
   <ul id="buttonlist">
     <li class="navbuttons">Home</li>
     <li class="navbuttons">About us</li>
     <li class="navbuttons">New Releases</li>
     <li class="navbuttons">Catalogue</li>
     <li class="navbuttons">Locate us</li>
     <li class="navbuttons">Contact us</li>
   </ul>
   </div> 
 </div>

CSS:

  .navbuttons{
display:inline-block;
padding-left:15px;
padding-right:15px;
padding-top:5px;
padding-bottom:5px;
height:30px;
font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
font-weight:bold;
font-size:18px;
color:#FFF;
background: rgb(110,156,183); /* Old browsers */
background: -moz-linear-gradient(top,  rgba(181,221,244,1) 0%, rgba(110,156,183,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(181,221,244,1)), color-stop(100%,rgba(110,156,183,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  rgba(181,221,244,1) 0%,rgba(110,156,183,1)) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  rgba(181,221,244,1) 0%,rgba(110,156,183,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  rgba(181,221,244,1) 0%,rgba(110,156,183,1) 100%); /* IE10+ */
background: linear-gradient(to bottom,  rgba(181,221,244,1) 0%,rgba(110,156,183,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b5ddf4', endColorstr='#6e9cb7',GradientType=0 ); /* IE6-9 */
}
#banner{
margin-top:0;
border-bottom: 1.5px solid #b9b7b7;
}

1 个答案:

答案 0 :(得分:1)

将您发布的HTML / CSS粘贴到JS Fiddle后,似乎padding: 0;#banner上设置了margin: 0 { {1}}和ul元素似乎将按钮放在.navbuttons元素的下边缘:

#banner

JS Fiddle demo