[英]placing horizontal list at the bottom boundary of the div
I have a horizontal unordered list just before the end tag of a div. 我在div的结束标记之前有一个水平的无序列表。 The list was placed at the boundary. 该清单位于边界。 Now I tried to add border-bottom: 1.5px solid #b9b7b7;
现在,我尝试添加下border-bottom: 1.5px solid #b9b7b7;
to the div, and the list just moves up from the boundary, as if there is a padding between the div bottom-border and the list, but there is no such padding in my css. 到div,列表就从边界上移,好像div底边框和列表之间有填充,但是我的CSS中没有这样的填充。 What can I do to add bottom border to the parent div and still place the last child element at the bottom boundary of the parent div? 我该怎么做才能在父div的底部添加边框,同时仍将最后一个子元素放在父div的底部边界?
EDIT: html 编辑: 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>
The CSS: 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;
}
Having pasted your posted HTML/CSS into JS Fiddle , it seems that setting padding: 0;
将您发布的HTML / CSS粘贴到JS Fiddle中之后 , 似乎设置padding: 0;
on the #banner
and margin: 0
on both the ul
and the .navbuttons
elements seems to place the buttons against the bottom edge of the #banner
element: 在#banner
和margin: 0
ul
和.navbuttons
元素上的0似乎都将按钮放在#banner
元素的底部边缘:
ul,
ul li.navbuttons {
margin: 0;
}
#banner{
/* your other CSS */
padding: 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.