首页 文章

需要一个没有任何子弹的无序列表

提问于
浏览
2177

我创建了一个无序列表 . 我觉得无序列表中的子弹很麻烦,所以我想删除它们 .

是否有可能没有子弹的列表?

27 回答

  • 192

    此订单列表垂直没有项目符号 . 只需一行!

    li{
            display: block;
        }
    
  • 3

    CSS:

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

    HTML:

    <ul class="liststyle">
        <li>Test</li>
    </ul>
    
  • 41

    下面的代码是一个很好的简单示例,用于删除无序列表的项目符号

    <!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>
    
  • 44

    如果你想在不诉诸css的情况下保持简单,我只需在我的代码行中添加一个 &nbsp; . 即 <table></table> 是的,它留下了一些空间,但这不是坏事 .

  • 3

    如果你正在使用Bootstrap,它有一个“没有样式”的类:

    删除列表项上的默认列表样式和左边距(仅限直接子项) .

    Bootstrap 2:

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

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

    Bootstrap 3和4:

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

    http://getbootstrap.com/css/#type-lists

  • 13

    CSS代码

    ul
    {
    list-style-type: none;
    }
    

    HTML代码

    <ul>
    <li><a href="#">Item One</a></li>
    <li><a href="#">Item Two</a></li>   
    </ul>
    
  • 0

    您可以通过设置 "list-style-type: none;" Like来删除 "bullets"

    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>
    
  • 1

    只需将 class 中的 list-style-typelist-style 更改为 none<li> .

    像这样的东西:

    li {
      list-style-type : none;
    }
    

    另外,为了获得更多信息,我列出了您可以分配给 list-style-type 的所有属性,运行下面的代码以查看一个目标中的所有结果:

    .none {
      list-style-type: none;
    }
    
    .disc {
      list-style-type: disc;
    }
    
    .circle {
      list-style-type: circle;
    }
    
    .square {
      list-style-type: square;
    }
    
    .decimal {
      list-style-type: decimal;
    }
    
    .georgian {
      list-style-type: georgian;
    }
    
    .cjk-ideographic {
      list-style-type: cjk-ideographic;
    }
    
    .kannada {
      list-style-type: kannada;
    }
    
    .custom:before {
      content: '◊ ';
      color: red;
    }
    
    <ul>
      <li class="none">none</li>
      <li class="disc">disc</li>
      <li class="circle">circle</li>
      <li class="square">square</li>
      <li class="decimal">decimal</li>
      <li class="georgian">georgian</li>
      <li class="cjk-ideographic">cjk-ideographic</li>
      <li class="kannada">kannada</li>
      <li class="none custom">custom</li>
    </ul>
    
  • -3

    如果您只想使用纯HTML实现此目标,此解决方案将适用于所有主流浏览器:

    Description Lists

    只需使用以下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

  • 18

    使用以下CSS:

    ul {
      list-style-type: none
    }
    
  • 3

    在css ...

    ul {
       list-style:none;
    }
    
  • 34

    如前所述,执行此操作的最佳方法是将 list-style-type: none 添加到 ul 元素 . bullet styles 上有一篇很棒的文章我认为你可以从here中受益 .

  • 3240

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

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

    这将删除子弹 . 您还可以在样式表中添加CSS,如上例所示 .

  • 35

    我在ul和li上都使用了list-style来删除子弹 . 我想用自定义角色替换子弹,在这种情况下是“破折号”,这样可以产生很好的效果 . 所以使用这个标记:

    <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;
    }
    

    给出一个很好的缩进效果,当文本换行时有效

  • 3

    即使你可以做到这一点 .

    ul {
      display: initial;
    }
    
  • 13

    对上述内容的细化:如果更长的线条溢出到其他屏幕线,则使更长的线条更具可读性:

    ul, li {list-style-type: none;}
    
    li {padding-left: 2em; text-indent: -2em;}
    
  • 1

    你需要使用 list-style: none;

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

    Native:

    ul { list-style-type: none; }
    

    Bootstrap:

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

    注意:如果您使用的是列表组,那么就不需要列表 - 无样式 .

  • 0
    <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>
    
  • 1

    您可以使用以下 CSS 删除 bullets

    ul {
             list-style: none; //or list-style-type:none; 
           }
    

    您甚至可以添加自定义列表样式,如:

    li:before {
                content: '✔';
                color:red;
              }
    
  • 498

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

    试试这个:

    <ul style="list-style-type:none" >
    
         <li>op1</li>
         <li>op2</li>
         <li>op2</li>
    
    </ul>
    
  • 0

    你可以试试这个

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

    您可以通过在父元素的CSS上设置list-style-typenone 来删除项目符号(通常为 <ul> ),例如:

    ul {
      list-style-type: none;
    }
    

    如果你想删除缩进,你可能还想添加 padding: 0margin: 0 .

    有关列表格式化技术的精彩演练,请参阅Listutorial .

  • 51

    在css,风格,

    list-style-type: none;
    
  • 1

    我尝试和观察的是

    header ul{
       margin: 0;
       padding: 0;
    }
    
  • 1

    你需要使用css list-style-type:none;

    ul {
      list-style-type: none;
    }
    
  • 3

    如果您无法使其在 <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>
    

相关问题