Victor Mukherjee
Victor Mukherjee

Reputation: 11025

placing horizontal list at the bottom boundary of the div

I have a horizontal unordered list just before the end tag of a div. The list was placed at the boundary. Now I tried to add 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. 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?

EDIT: 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:

  .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;
}

Upvotes: 0

Views: 131

Answers (1)

David Thomas
David Thomas

Reputation: 253308

Having pasted your posted HTML/CSS into JS Fiddle, it seems that setting 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:

ul,
ul li.navbuttons {
    margin: 0;
}
#banner{
    /* your other CSS */
    padding: 0;
}​

JS Fiddle demo.

Upvotes: 1

Related Questions