CSS UL LI Vertical Menu

ぐ巨炮叔叔 提交于 2019-12-05 16:53:28

I'd do it like this:

  1. Set your <a> tags to display:block

  2. Remove the padding from your <li>'s (make it padding:0px)

  3. Re-add the padding to your <a> tags padding:7px 10px 7px 10px;

  4. Add background-color:#ffcc00; to #Menu a:hover

  5. Get rid of #Menu li:hover

need to add #Menu li:hover a {color:White;} This will set white color for a when a li is hovered.

Demo: http://jsfiddle.net/Nceef/

Give this css properties:

#Menu a {display:block}
#Menu a:hover,active {color:#text-color;background:#background-color;}
#Menu li
{
    border-bottom:1px solid #eeeeee;
}

#Menu li a:hover
{
    color:White;
    background-color:#ffcc00;
}

#Menu a:link
{
    color:#717171;
    text-decoration:none;
    display:block;
    padding: 7px 10px;
}          

Only drawback of this method is your elements in the list that arent anchors wont be padded correctly.

Demo

http://jsfiddle.net/loktar/F6UGv/

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