How to style a list within a menu?

断了今生、忘了曾经 提交于 2019-12-07 01:00:32

Ok so just had a look at firebugs output on the styling of the <ul> tag you have. And the CSS rules are specific to the <ul> tags within #mega.

So I added this CSS that targets the UL you want to style and reset a few rules:

ul#mega moreleftbar ul,
ul#mega moreleftbar ul li,
ul#mega moreleftbar ul li a,
ul#mega moreleftbar ul li a:hover
{
    padding:0;
    border:0;
    margin:0;
    color:#000000;
    font-size:inherit;
    font-weight:normal;
    background:none;
}

JSfiddle example

Notice your original rule for styling the <li>

ul#mega li

This will be overwritten by the targetted rules I've applied above.

By being more specific with the rules, they overwrite less specific styles (unless a style has an !important tagged to it).

.manimation:hover{
    background:#43cf61 !important;
}

The above rule for example will stop you being able to apply any further background-color changes to any elements that are covered by the rule. !important is not a good thing to use unless it is absolutely necessary.

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