我需要一个没有任何项目符号的无序列表

HTML

路易GO

2020-03-13

我创建了一个无序列表。我觉得无序列表中的项目符号很麻烦,因此我想删除它们。

可以有没有项目符号的清单吗?

第1417篇《我需要一个没有任何项目符号的无序列表》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

25个回答
乐猪猪 2020.03.13

As previously mentioned, the best way to do this is by adding list-style-type: none to the ul element. There is a great article on bullet styles I think you could benefit from here.

null 2020.03.13

The below code is a good and simple example to remove bullets for an unordered list.

<!DOCTYPE html>
<html>
    <body>

    <h2>Unordered List without Bullets</h2>

    <ul style="list-style-type:none">
        <li>Coffee</li>
        <li>Tea</li>
        <li>Milk</li>
    </ul>

    </body>
</html>
阳光樱前端 2020.03.13

If you are using ul in a div block then

// HTML file
<div class="some-class">
    <ul>
        <li>One</li>
    </ul>
</div>

In your style sheet

.some-class ul {
       list-style: none;
}

If you are just using ul directly without any class or div block:

//Style Sheet
ul {
    list-style: none;
}
GIZO-俊宏 2020.03.13

我尝试并观察到:

header ul {
   margin: 0;
   padding: 0;
}
老丝 2020.03.13

您可以通过设置“列表样式类型:无;”来删除“项目符号” 喜欢

ul
{
    list-style-type: none;
}

要么

<ul class="menu custompozition4"  style="list-style-type: none;">
    <li class="item-507"><a href=#">Strategic Recruitment Solutions</a>
    </li>

</ul>
Mandy梅Green 2020.03.13
 <div class="custom-control custom-checkbox left">
    <ul class="list-unstyled">
        <li>
         <label class="btn btn-secondary text-left" style="width:100%;text-align:left;padding:2px;">
           <input type="checkbox" style="zoom:1.7;vertical-align:bottom;" asp-for="@Model[i].IsChecked" class="custom-control-input" /> @Model[i].Title
         </label>
        </li>
     </ul>
</div>
Itachi村村 2020.03.13

您可以使用删除项目符号style="list-style-type:none"

尝试这个:

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

     <li>op1</li>
     <li>op2</li>
     <li>op2</li>

</ul> 
Mandy番长 2020.03.13

如果您正在开发现有主题,则该主题可能具有自定义列表样式。

因此,如果您无法使用list-style: none;ul或li标签更改列表样式,请先进行检查,!important因为其他样式可能会覆盖您的样式。

如果不是这种情况,请检查li:before是否包含内容。然后做:

li:before { dispaly: none; }
小胖Sam 2020.03.13

如果您想使用 HTML 来完成此任务,则此解决方案将在所有主要浏览器上均适用:

说明清单

只需使用以下HTML:

<dl>
  <dt>List Item 1</dt>
    <dd>Sub-Item 1.1</dd>
  <dt>List Item 2</dt>
    <dd>Sub-Item 2.1</dd>
    <dd>Sub-Item 2.2</dd>
    <dd>Sub-Item 2.3</dd>
  <dt>List Item 3</dt>
    <dd>Sub-Item 3.1</dd>
</dl>

它将产生类似于以下内容的列表:

List Item 1
     Sub-Item 1.1
List Item 2
     Sub-Item 2.1
     Sub-Item 2.2
     Sub-Item 2.3
List Item 3
     Sub-Item 3.1

此处的示例:https : //jsfiddle.net/zumcmvma/2/

参考在这里:https : //www.w3schools.com/tags/tag_dl.asp

Near梅 2020.03.13

CSS代码

ul
{
    list-style-type: none;
}

HTML代码

<ul>
    <li><a href="#">Item One</a></li>
    <li><a href="#">Item Two</a></li>   
</ul>
小小LEY伽罗 2020.03.13

这将垂直排列列表,没有项目符号点。只需一行!

li {
    display: block;
}
阿飞GilGreen 2020.03.13

你可以试试这个

ul {
  list-style: none
}
<ul>
<li>List 1</li>
<li>List 2</li>
<li>List 3</li>
<li>List 4</li>
</ul>

老丝伽罗 2020.03.13

CSS:

.liststyle {
    list-style-type: none;
}

HTML:

<ul class="liststyle">
    <li>Test</li>
</ul>
路易飞云 2020.03.13

要完全删除ul默认样式:

    list-style-type: none;

    margin: 0;
    margin-block-start: 0;
    margin-block-end: 0;
    margin-inline-start: 0;
    margin-inline-end: 0;
    padding-inline-start: 0;
小哥宝儿 2020.03.13

使用以下CSS:

ul {
  list-style-type: none
}
别坑我路易 2020.03.13

我在ul和li上都使用了列表样式来删除项目符号。我想将项目符号替换为自定义字符,在本例中为“破折号”。这样效果很好。因此,使用此标记:

<ul class="dashed-list">
  <li>text</li>
  <li>text</li>
</ul>

使用此CSS:

ul.dashed-list
{
    list-style: none outside none;
}

ul.dashed-list li:before {
    content: "\2014";
    float: left;
    margin: 0 0 0 -27px;
    padding: 0;
}

ul.dashed-list li {
    list-style-type: none;
}

产生一个很好的缩进效果,当文本自动换行时可以使用。

番长凯 2020.03.13

如果您无法使其在<ul>级别上工作,则可能需要将其放置list-style-type: none;<li>级别上:

<ul>
    <li style="list-style-type: none;">Item 1</li>
    <li style="list-style-type: none;">Item 2</li>
</ul>

您可以创建一个CSS类来避免这种重复:

<style>
ul.no-bullets li
{
    list-style-type: none;
}
</style>

<ul class="no-bullets">
    <li>Item 1</li>
    <li>Item 2</li>
</ul>

必要时使用!important

<style>
ul.no-bullets li
{
    list-style-type: none !important;
}
</style>
Eva达蒙 2020.03.13

本机:

ul { list-style-type: none; }

引导程序:

<ul class="list-unstyled list-group">
    <li class="list-group-item">...</li>
</ul>

注意:如果您使用列表组,则不需要列表样式。

卡卡西Near 2020.03.13

对先前的答案进行细微的改进:如果较长的行溢出到其他屏幕行中,则使它们更易读:

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

li {padding-left: 2em; text-indent: -2em;}
十三L 2020.03.13

您将必须向<ul>元素添加样式,如下所示:

<ul style="list-style: none; ">
    <li>Item</li>
    ...
    <li>Item</li>
</ul>

那将删除子弹。您也可以像以前答案中的示例一样,在样式表中添加CSS。

猪猪JinJin西里 2020.03.13

在CSS中,样式

 list-style-type: none;
梅十三 2020.03.13

在CSS中...

ul {
   list-style: none;
}
Stafan小小斯丁 2020.03.13

您需要使用 list-style: none;

<ul style="list-style: none;">
    <li> ...</li>
</ul>
理查德阿飞 2020.03.13

如果您使用的是Bootstrap,则它具有“未样式化”的类:

删除列表项的默认列表样式和左填充(仅适用于立即子级)。

引导程序2:

<ul class="unstyled">
   <li>...</li>
</ul>

http://twitter.github.io/bootstrap/base-css.html#typography

引导程序3和4:

<ul class="list-unstyled">
   <li>...</li>
</ul>

引导程序3:http//getbootstrap.com/css/#type-lists

引导程序4:https//getbootstrap.com/docs/4.3/content/typography/#unstyled

梅Harry米亚 2020.03.13

你可以通过设置除去子弹list-style-typenone在CSS的父元素(典型的是<ul>),例如:

ul {
  list-style-type: none;
}

您可能还需要增加padding: 0margin: 0对,如果你想删除的缩进以及。

有关列表格式技术的详细演练,请参见Listutorial

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android