【问题标题】:Removing bullets from ul, "list-style: none" not working从 ul 中删除项目符号,“列表样式:无”不起作用
【发布时间】:2018-01-07 06:43:07
【问题描述】:

我正在使用 Wordpress 的 wp-nav-menu 功能生成 ul,但似乎无法让子弹消失。我已经尝试了所有组合,使用 id="menu-main-menu":

ul#menu-main-menu, ul#menu-main-menu li {
    list-style: none;
    list-style-type: none;
}

我尝试按类和 ID 指定 ul,但没有成功。尝试了父容器以获得更多规范,不行。我什至不能内联样式,因为在页面加载之前不会呈现 HTML。

不知道还有什么可以尝试的。我很确定没有冲突的 CSS,因为我正在使用新的样式表。

【问题讨论】:

  • 使用开发工具检查元素,看看样式是否被覆盖 - 或者根本没有应用。还要检查你的选择器。 ul#menu-main-menu 真的正确吗?
  • 你总是可以尝试在末尾使用 !important,比如 list-style: none !important;
  • 检查你的缓存,看看你有没有缓存插件
  • 成功了,小伙子,我觉得自己很愚蠢。谢谢!

标签: html css wordpress html-lists


【解决方案1】:

编辑:根据 Temani Afif,我清除了浏览器的缓存,你瞧,没有子弹了。感谢大家的帮助!

很确定 id 是正确的。我太新了,无法发布图片,但这是检查员在 Chrome 上显示的内容的 imgur 链接:https://i.stack.imgur.com/hDm1h.jpg

id 是由 Wordpress 自动生成的,我从来没有使用过。

我回去了,在样式表中找不到任何东西,但这里有一些更精明的眼睛可以查看。

我添加了!重要,没有骰子。

html {

}

body {

}

.container {
    background-color: crimson;
    display: flex;
    flex-direction: column;
}

.header {
    background-color: floralwhite;
    padding: 10px;
    display: flex;
}

.mainTitle {
    flex: 1;
    background-color: antiquewhite;
    text-align: center;
    font-size: 3em;
}

.mainSection-container {
    background-color: dimgray;
    display: flex;
    flex-direction: column;
}

.contentRow-1 {
    background-color: darkcyan;
    display: flex;
    flex-direction: column;
}

.menuSidebar {
    flex: 1;
    background-color: #f4f2e5;
    padding: 10px;
    order: 2;
}

ul#menu-main-menu, ul#menu-main-menu li {
    list-style: none;
    list-style-type: none;
}

.todaysArticle {
    flex: 3;
    background-color: #f7f7f7;
    padding: 10px;
    order: 1;
}

.todaysArticle-text {

}

.todaysImage {

}

.dark-text-background {
    background-color: rgba(57, 57, 57, 0.56);
    padding-right: 2px;
    padding-left: 2px;
}

.sidebar-2 {
    flex: 1;
    background-color: #fff8e7;
    padding: 10px;
    order: 3;
}

@media (min-width: 900px) {
    .contentRow-1 {
        flex-direction: row;
    }
    .menuSidebar {
        order: 1;
    }
    .todaysArticle {
        order: 2;
    }
    .side-bar-2 {
        order: 3;
    }
}


.contentRow-2 {
    background-color: floralwhite;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.articleStub {
    background-color: #e6edf0;
    width: 300px;
    padding: 10px;
    margin: 10px;
}

.image {
    max-width: 100%;
}
.postSection {
    flex: 4;
    background-color: aqua;
    padding: 10px;
    order: 1;
}

.dummySpace {
    flex: 1;
    background-color: cadetblue;
    padding: 10px;
    order: 3;
}

.postImage {
    max-width: 100%;
}

@media (min-width: 900px) {
    .contentRow-1 {
        flex-direction: row;
    }
    .menuSidebar {
        order: 1;
    }
    .postSection {
        order: 2;
    }
    .dummySpace {
        order: 3;
    }
    .postImage {
        max-width: 600px;
    }
}

.authorSection {
    flex: 3;
    order: 1;
    padding: 10px;
    background-color: darkgoldenrod;
}

.authorImage {
    max-width: 100%;
}

@media (min-width: 900px) {
    .contentRow-1 {
        flex-direction: row;
    }
    .menuSidebar {
        order: 1;
    }
    .authorSection {
        order: 2;
    }
    .authorImage {
        max-width: 600px;
    }
}

【讨论】:

    猜你喜欢
    • 2022-01-19
    • 2014-10-29
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    • 2012-08-23
    • 2018-12-11
    • 2010-11-21
    相关资源
    最近更新 更多