简体   繁体   English

在Bootstrap导航列表中还原列表样式

[英]Restore list-style in a Bootstrap navigation list

I am having difficulties restoring the bullet points in a Bootstrap navigation list. 我在恢复Bootstrap导航列表中的项目符号时遇到困难。 My markup is generated by WordPress but the general idea is: 我的标记是由WordPress生成的,但总体思路是:

<nav>
    <ul class='nav navbar-nav'>
        <li><a href='#'>Home</a></li>
        <li><a href='#'>Home</a></li>
        <li><a href='#'>Home</a></li>
        <li><a href='#'>Home</a></li>
    </ul>
</nav>

I've looked through the styles Bootstrap has applied to what is basically a list, and I can't figure out what is removing the list-style which was originally there. 我已经仔细研究了Bootstrap应用于基本上是列表的样式,但我不知道是什么删除了原来存在的列表样式。

I tried to set things back to the default by using the below, but this hasn't worked. 我试图通过使用以下内容将其设置为默认值,但这没有用。

footer nav ul.nav > li {
    list-style-type:disc;
}

I am hoping there are any Bootstrap wizards out there who can help me resolve this issue. 我希望那里有任何Bootstrap向导可以帮助我解决此问题。

If you can't change the markup as skelly suggested, you'll have to also override the display property back to list-item , so you're CSS should look like this: 如果您无法按照建议的方式更改标记,则还必须将display属性改写回list-item ,因此CSS看起来应该像这样:

footer nav ul.nav > li {
  margin-left: 40px;
  list-style-type: disc;
  display: list-item
}

Demo in Stack Snippets 堆栈片段中的演示

 footer nav ul.nav > li { margin-left: 40px; list-style-type: disc; display: list-item } 
 <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/> <footer> <nav> <ul class='nav navbar-nav'> <li><a href='#'>Home</a></li> <li><a href='#'>Home</a></li> <li><a href='#'>Home</a></li> <li><a href='#'>Home</a></li> </ul> </nav> </footer> 


There's still a lot of other CSS styles that would be affecting the list type. 还有许多其他CSS样式会影响列表类型。 If you want to remove them all, and if you can run javascript on the page, you can just remove the classes with jQuery like this: 如果要全部删除它们,并且可以在页面上运行javascript,则可以使用jQuery这样删除类:

$("footer nav ul.nav.navbar-nav").removeClass("nav navbar-nav");

Demo in Stack Snippets 堆栈片段中的演示

 $("footer nav ul.nav.navbar-nav").removeClass("nav navbar-nav"); 
 footer nav ul.nav > li { margin-left: 40px; list-style-type: disc; display: list-item } 
 <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <footer> <nav> <ul class='nav navbar-nav'> <li><a href='#'>Home</a></li> <li><a href='#'>Home</a></li> <li><a href='#'>Home</a></li> <li><a href='#'>Home</a></li> </ul> </nav> </footer> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM