无法将ul li列表对齐到div的顶部

时间:2014-01-26 14:16:33

标签: html css html-lists

我在将li元素与ul标签和div标签内的顶部对齐时遇到了问题。

我的css代码:

div{

    background-color: yellow;
}

ul{

    list-style-type: none;
    display: inline;
}

li{
        border: 1px solid       #044062 /*{b-bup-border}*/;
    background:             #396b9e /*{b-bup-background-color}*/;
    font-weight: bold;
    color:                  #fff /*{b-bup-color}*/;
    text-shadow: 0 /*{b-bup-shadow-x}*/ 1px /*{b-bup-shadow-y}*/ 1px /*{b-bup-shadow-radius}*/ #194b7e /*{b-bup-shadow-color}*/;
    background-image: -webkit-gradient(linear, left top, left bottom, from( #5f9cc5 /*{b-bup-background-start}*/), to( #396b9e /*{b-bup-background-end}*/)); /* Saf4+, Chrome */
    background-image: -webkit-linear-gradient( #5f9cc5 /*{b-bup-background-start}*/, #396b9e /*{b-bup-background-end}*/); /* Chrome 10+, Saf5.1+ */
    background-image:    -moz-linear-gradient( #5f9cc5 /*{b-bup-background-start}*/, #396b9e /*{b-bup-background-end}*/); /* FF3.6 */
    background-image:     -ms-linear-gradient( #5f9cc5 /*{b-bup-background-start}*/, #396b9e /*{b-bup-background-end}*/); /* IE10 */
    background-image:      -o-linear-gradient( #5f9cc5 /*{b-bup-background-start}*/, #396b9e /*{b-bup-background-end}*/); /* Opera 11.10+ */
    background-image:         linear-gradient( #5f9cc5 /*{b-bup-background-start}*/, #396b9e /*{b-bup-background-end}*/);
    height:15%;
    position: relative;

}

这里是小提琴:    http://jsfiddle.net/agkVd/ 如你所见,li元素与ul和div的底部对齐(我在顶部看到div背景,我需要它在底部)

...谢谢

1 个答案:

答案 0 :(得分:0)

从ul中删除填充,您将看不到任何黄色:

ul {    
   list-style-type: none;
   display: inline;
   padding:0;
}