How can I positioning LI elements to the bottom of UL list

主宰稳场 提交于 2019-12-01 15:36:01

Use display: inline-block instead of float:

ul.menu
{                 
   vertical-align: bottom;
}

ul.menu li
{    
   display: inline-block;
   text-align: center;
}

EDIT: Added text-align: center;. If I understand your comment correctly, that is what you want. If not, you'll need to be more specific.

http://css-tricks.com/what-is-vertical-align/ This link might help, alternatively you could create the result as table based content with the content aligned to the bottom of each cell.

Assuming that following is your html

<div>
    <ul>
        <li><a>Row1</a></li>
        <li><a>Row1 Row2 Row3</a></li>
        <li><a>Row1</a></li>
        <li><a>Row1 Row 2</a></li>
    </ul>
</div>

You can simply style your CSS as following

li {
    position:relative;
    float:left;       
}

li a {
    position:absolute;
    bottom:0;
}

Above code should work across browsers (I have not tested this across browsers)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!