简体   繁体   English

摆脱要点<ul></ul>

[英]Getting rid of bullet points from <ul>

I have the following list:我有以下列表:

 <ul id="otis">
 <li>Benz</li>
 <li>Other Benz</li>
 <li>Other Other Benz</li>
 </ul>

I want to get rid the bullets so i tried:我想摆脱子弹,所以我尝试了:

 ul#otis {
 list-style-type: none;
 }

That didn't work though.但这没有用。 What is the proper way to remove the bullets from the displayed list?从显示的列表中删除项目符号的正确方法是什么?

Assuming that didn't work, you might want to combine the id -based selector with the li in order to apply the css to the li elements:假设这不起作用,您可能希望将基于id的选择器与li结合起来,以便将 ZC7A62​​8CBA22E28EB17B5F5C6AE2A266AZ 应用于li元素:

#otis li {
    list-style-type: none;
}

Reference:参考:

I had the same extreme irritating problem myself since the script did not take any notice of my styelsheet.我自己也遇到了同样令人恼火的问题,因为脚本没有注意到我的样式表。 So I wrote:所以我写道:

<ul style="list-style-type: none;">

That did not work.那没有用。 So, in addition , I wrote:所以,另外,我写道:

<li style="list-style-type: none;">

Voila it worked瞧,它奏效了

The following code以下代码

 #menu li{ list-style-type: none; }
 <ul id="menu"> <li>Root node 1</li> <li>Root node 2</li> </ul>

will produce this output:将产生这个 output:

输出是

To remove bullet points from unordered lists, you can use:要从无序列表中删除项目符号点,您可以使用:

list-style: none;

You can also use:您还可以使用:

list-style-type: none;

Either works but the first is a shorter way to get the same result.两种方法都可以,但第一种方法是获得相同结果的更短的方法。

Try this instead, tested on Chrome/Safari试试这个,在 Chrome/Safari 上测试

ul {
 list-style: none;
}

To remove bullet from UL you can simply use list-style: none;要从UL中删除项目符号,您可以简单地使用list-style: none; or list-style-type: none;list-style-type: none; If still not works then i guess there is an issue of priority CSS .如果仍然不起作用,那么我想存在优先级问题CSS May be globally UL already defined.可能已经在全球范围内定义了 UL。 So best way add a class/ID to that particular UL and add your CSS there.所以最好的方法是向那个特定的 UL 添加一个类/ID,然后在那里添加你的CSS Hope it will works.希望它会奏效。

This worked perfectly HTML这工作得很好HTML

<ul id="top-list">
        <li><a href="#">Home</a></li>
        <li><a href="#">Process</a></li>
        <li><a href="#">Work</a></li>
        <li><a href="#">Team</a></li>
        <li><a href="#">Contact</a></li>
      </ul>

CSS CSS

#top-list{
  list-style-type: none;
  list-style: none;}

Put

<style type="text/css">
 ul#otis {
     list-style-type: none;
   }
</style>

immediately before the list to test it out.就在列表之前对其进行测试。 Or或者

<ul style="list-style-type: none;">

I had the same problem, and the way I ended up fixing it was like this:我有同样的问题,我最终修复它的方式是这样的:

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

Maybe it's a little extreme, but when I did that, it worked for me.也许这有点极端,但是当我这样做时,它对我有用。


Hope this helped 希望这有帮助

for inline style sheet try this code对于内联样式表,试试这个代码

<ul style="list-style-type: none;">
    <li>Try This</li>
    </ul>

In a chrome, you can use在 chrome 中,您可以使用

ul {
 list-style: none;
}

There must be something else.一定有别的东西。

Because:因为:

   ul#otis {
     list-style-type: none;
   }

should just work.应该可以工作。

Perhaps there is some CSS rule which overwrites it.也许有一些 CSS 规则会覆盖它。

Use your DOM inspector to find out.使用你的 DOM 检查器来找出答案。

your code:你的代码:

ul#otis {
    list-style-type: none;
}

my suggestion:我的建议:

#otis {
    list-style-type: none;

}

in css you need only use the #id not element#id .在 ZC7A62​​8CBA22E28EB17B5F5C6AE2A266AZ 中,您只需要使用#id而不是element#id more helpful hints are provided here: w3schools此处提供了更多有用的提示: w3schools

I had an identical problem.我有一个相同的问题。

The solution was that the bullet was added via a background image , NOT via list-style-type.解决方案是子弹是通过背景图像添加的,而不是通过列表样式类型。 A quick 'background: none' and Bob's your uncle快速的“背景:无”,鲍勃是你的叔叔

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

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