【问题标题】:List-style-type: none does not work in the removal of bullets(dots) attached with items in the navigation bar [duplicate]列表样式类型:无不适用于删除导航栏中项目附加的项目符号(点)[重复]
【发布时间】:2020-04-25 06:19:49
【问题描述】:

输出:

我是一个绝对的初学者,在创建基本导航栏时,我 我正面临这个问题。我要消除红圈点 与我的列表项相关联。请告诉我我在哪里做错了。 我之前的问题被标记为重复,这个参考是 假如 : I need an unordered list without any bullets 这是我的老问题: Removal of bullets(dots) attached with items in the navigation bar

解决方案指出list-style-type: none; 将解决 问题,我也将此解决方案应用于我的代码,但没有任何改变。

CSS 代码:

   *{padding: 0; margin: 0; box-sizing: border-box;}

    #Header
    {
        background-color: #ffad66;
        font-family: 'Reem Kufi', sans-serif;
        font-weight: 900;
        font-size: 50px;
        color: #800000;
        text-align: center;
        height: 120px;
        box-sizing: border-box;
        padding: 22px;

        /* this line was not in my code from the previous question which was marked duplicated and*/
        list-style-type: none;

   }

    .NavItems a 
    {
        text-decoration: none;
        list-style: none;
        font-size: 14px;
        font-weight: bold;
        font-family: 'Times New Roman', Times, serif;
        color:green;
        margin: 10px; 
        padding: 10px;
    }
    .NavItems a:hover
    {
        background-color: #33E3FF;
        color: black;
    }

    .NavBarItem
    {

     display: flex;
     justify-content: center;

    }
    .MyNavBar
    {
        width: 100%;
        background-color: lightblue;
        height: 35px;
        box-sizing: border-box;
        padding: 8px;      
    }

HTML 代码: 这是body标签下唯一的一段代码。

<header id="Header">
    پوشاک
</header>
<nav class="MyNavBar">
    <ul class="NavBarItem">
        <li class="NavItems"><a href="#Men">Men</a></li>
        <li class="NavItems"><a href="#Women">Women</a></li>
        <li class="NavItems"><a href="#Kids">Kids</a></li>

    </ul>
</nav>

【问题讨论】:

标签: html css


【解决方案1】:

list-style: none; 必须在 ul 而不是 a 标签上

【讨论】:

  • 感谢您帮助绝对的初学者。
猜你喜欢
  • 2022-01-19
  • 1970-01-01
  • 1970-01-01
  • 2015-04-04
  • 1970-01-01
  • 2015-11-07
  • 1970-01-01
  • 2020-05-15
  • 1970-01-01
相关资源
最近更新 更多