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?
转载于:https://stackoverflow.com/questions/1027354/need-an-unordered-list-without-any-bullets
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.
You need to use list-style: none;
<ul style="list-style: none;">
<li> ...</li>
</ul>
Use the following CSS:
ul {
list-style-type: none
}
in css...
ul {
list-style:none;
}
in css , style ,
list-style-type: none;
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.
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;}
In case you want to keep things simple without resorting to css, I just put a
in my code lines. I.e. <table></table>
Yeah it leaves a few spaces but thats no bad thing.
If you're using Bootstrap, it has an "unstyled" class:
Remove the default list-style and left padding on list items (immediate children only).
<ul class="unstyled">
<li>...</li>
</ul>
http://twitter.github.io/bootstrap/base-css.html#typography
<ul class="list-unstyled">
<li>...</li>
</ul>
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
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>
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>
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.
CSS:
.liststyle {
list-style-type: none;
}
HTML:
<ul class="liststyle">
<li>Test</li>
</ul>
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>
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;
}
This orders list vertically without bullet points. In just one line!
li{
display: block;
}
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>
</div>
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>
You need to use css list-style-type: none;
ul {
list-style-type: none;
}
</div>
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
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.
<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>
What i tried and observed was
header ul{
margin: 0;
padding: 0;
}
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>
Even you can do this.
ul {
display: initial;
}