- This topic is empty.
- AuthorPosts
-
June 22, 2009 at 8:57 am #9161
David Hoang
KeymasterI 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?
June 22, 2009 at 9:00 am #9177David Hoang
KeymasterYou can remove bullets by setting the
list-style-type
tonone
on the CSS for the parent element (typically a<ul>
), for example:ul { list-style-type: none; }
You might also want to add
padding: 0
andmargin: 0
to that if you want to remove indentation as well.See Listutorial for a great walkthrough of list formatting techniques.
June 22, 2009 at 9:00 am #9175David Hoang
KeymasterYou need to use
list-style: none;
<ul style="list-style: none;"> <li>...</li> </ul>
December 10, 2012 at 12:55 pm #9174David Hoang
KeymasterSmall refinement to the previous answers: 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;}
March 15, 2013 at 5:48 am #9162David Hoang
KeymasterIn 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 that’s not a bad thing.
July 11, 2013 at 10:05 am #9176David Hoang
KeymasterIf 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, 4, and 5:
<ul class="list-unstyled"> <li>...</li> </ul>
Bootstrap 3: http://getbootstrap.com/css/#type-lists
Bootstrap 4: https://getbootstrap.com/docs/4.3/content/typography/#unstyled
Bootstrap 5: https://getbootstrap.com/docs/5.0/content/typography/#unstyled
September 17, 2013 at 11:52 am #9172David Hoang
KeymasterI 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 nicely indented effect that works fine when the text wraps.ul.dashed-list { list-style: none outside none; } ul.dashed-list li:before { content: "14"; float: left; margin: 0 0 0 -27px; padding: 0; } ul.dashed-list li { list-style-type: none; }
<ul class="dashed-list"> <li>text</li> <li>text</li> </ul>
October 8, 2013 at 3:14 am #9173David Hoang
KeymasterIf you’re unable to make it work at the
<ul>
level, you might need to place thelist-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>
When necessary, use
!important
:<style> ul.no-bullets li { list-style-type: none !important; } </style>
September 3, 2016 at 5:59 am #9170David Hoang
KeymasterThis orders a list vertically without bullet points. In just one line!
li { display: block; }
March 23, 2018 at 8:26 am #9171David Hoang
KeymasterIf 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>
Example here: https://jsfiddle.net/zumcmvma/2/
Reference here: https://www.w3schools.com/tags/tag_dl.asp
April 26, 2018 at 11:16 am #9163David Hoang
Keymaster<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>
July 24, 2018 at 1:26 am #9164David Hoang
KeymasterI tried and observed:
header ul { margin: 0; padding: 0; }
April 23, 2019 at 9:55 am #9168David Hoang
KeymasterTo completely remove the
ul
default style: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;
January 27, 2020 at 6:47 am #9169David Hoang
KeymasterIf you are developing an existing theme, it’s possible that the theme has a custom list style.
So if you can’t change the list style using
list-style: none;
in ul or li tags, first check with!important
, because maybe some other line of style is overwriting your style. If!important
fixed it, you should find a more specific selector and clear out the!important
.li { list-style: none !important; }
If it’s not the case, then check the
li:before
. If it contains the content, then do:li:before { display: none; }
July 30, 2020 at 12:55 pm #9165David Hoang
Keymasterul{list-style-type:none;}
Just set the style of unordered list is none.
- AuthorPosts
- You must be logged in to reply to this topic.