RussellHarrower
RussellHarrower

Reputation: 6800

LI height same as UL

Hi I am wondering how come my UL is 38px height yet the LI does not fit 100% height.

ul#ordermenu{
    height:38px !important;
    width:100% !important;
    line-height:38px;
}

ul#ordermenu li
{
height:38px !important;
display: inline;
list-style-type: none;
padding-right: 100px;
color:#000;
line-height:38px;
font-size:20px;
}

ul#ordermenu li:last-child {
    padding-right:-100px;
}
ul#ordermenu li.active
{
height:38px !important;
line-height:38px;
background: #e6f0a3; /* Old browsers */
background: -moz-linear-gradient(top,  #e6f0a3 0%, #d2e638 50%, #c3d825 51%, #dbf043 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e6f0a3), color-stop(50%,#d2e638), color-stop(51%,#c3d825), color-stop(100%,#dbf043)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #e6f0a3 0%,#d2e638 50%,#c3d825 51%,#dbf043 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #e6f0a3 0%,#d2e638 50%,#c3d825 51%,#dbf043 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #e6f0a3 0%,#d2e638 50%,#c3d825 51%,#dbf043 100%); /* IE10+ */
background: linear-gradient(to bottom,  #e6f0a3 0%,#d2e638 50%,#c3d825 51%,#dbf043 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e6f0a3', endColorstr='#dbf043',GradientType=0 ); /* IE6-9 */

}

My HTML code

 <ul id="ordermenu">
        <li class="active">Items</li>
        <li>Checkout Status</li>
        <li>Postage Details</li>
    </ul>

Upvotes: 0

Views: 1688

Answers (2)

j.koch
j.koch

Reputation: 8

You cannot assign a height to inline elements, as you are doing for ul#ordermenu li. Try changing the display property to 'inline-block'. This will allow you to give the list-items a specific height while still arranging them horizontally.

Upvotes: 2

Kevin Boucher
Kevin Boucher

Reputation: 16675

The reason the li is not 38px tall is because of the display: inline on ul#ordermenu li

Try this:

#ordermenu li {
    display: inline-block;
    height: 38px;
}

Upvotes: 2

Related Questions