Need an unordered list without any bullets

2018-12-31 23:50发布

问题:

I have created an unordered list. I feel the bullets in the unordered list are bothersome, so I want to remove them.

Is it possible to have a list without bullets?

回答1:

You can remove bullets by setting the list-style-type to none on the CSS for parent element (typically a <ul>), for example:

ul {
  list-style-type: none;
}

You might also want to add padding: 0 and margin: 0 to that, if you want to remove indentation as well.

See Listutorial for a great walkthrough of list formatting techniques.



回答2:

If you\'re using Bootstrap, it has an \"unstyled\" class:

Remove the default list-style and left padding on list items (immediate children only).

Bootstrap 2:

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

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

Bootstrap 3 and 4:

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

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



回答3:

You need to use list-style: none;

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


回答4:

in css , style ,

 list-style-type: none;


回答5:

You would have to add a style to the <ul> element like the following:

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

That will remove the bullets. You could also add the CSS in a stylesheet like the examples above.



回答6:

in css...

ul {
   list-style:none;
}


回答7:

Small refinement to the above: To make longer lines more readable if they spill over to additional screen lines:

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

li {padding-left: 2em; text-indent: -2em;}


回答8:

Use the following CSS:

ul {
  list-style-type: none
}


回答9:

Native:

ul { list-style-type: none; }

Bootstrap:

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

Note: If you\'re using list-groups, then there is no need for list-unstyled.



回答10:

If you\'re unable to make it works at the <ul> level, you might need to place the list-style-type: none; at the <li> level:

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

You can create a CSS class to avoid this repetition:

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

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

EDIT: When necessary, use !important:

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


回答11:

I used list-style on both the ul and the li to remove the bullets. I wanted to replace the bullets with a custom character, in this case a \'dash\', that gives a nice effect. So using this markup:

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

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

gives a nicely indented effect that works when the text wraps



回答12:

CSS:

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

HTML:

<ul class=\"liststyle\">
    <li>Test</li>
</ul>


回答13:

CSS CODE

ul
{
list-style-type: none;
}

HTML CODE

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


回答14:

You can remove bullets by using the following CSS:

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

You may even add your custom list style like:

li:before {
            content: \'✔\';
            color:red;
          }


回答15:

This orders list vertically without bullet points. In just one line!

 li{
        display: block;
    }


回答16:

You can remove bullets using style=\"list-style-type:none\".

Try this:

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

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

</ul> 


回答17:

You can try this

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



回答18:

If you wanted to accomplish this with pure HTML alone, this solution will work across all major browsers:

Description Lists

Simply using the following 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>

Which will produce a list similar to the following:

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

Example here: https://jsfiddle.net/zumcmvma/2/

Reference here: https://www.w3schools.com/tags/tag_dl.asp



回答19:

What i tried and observed was

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


回答20:

You can remove the \"bullets\" by setting the \"list-style-type: none;\" Like

ul
{
    list-style-type: none;
}

OR

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

</ul>


回答21:

Below code is a good and simple example to removed 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>


回答22:

Just change your list-style-type or list-style in your class to none for the <li>.

Something like this:

li {
  list-style-type : none;
}

Also for further information, I list all properties you can assign to list-style-type, run the code below to see all the result in one goal:

.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>



回答23:

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


回答24:

You need to use css list-style-type: none;

ul {
  list-style-type: none;
}



回答25:

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.



回答26:

In case you want to keep things simple without resorting to css, I just put a &nbsp; in my code lines. I.e. <table></table> Yeah it leaves a few spaces but thats no bad thing.



标签: html css