How to make a HTML list appear without the bullets signs using CSS only?
Asked Answered
P

5

12

I have an HTML list. The browser should see the list's existence and arrange the elements accordingly, however I don't want it to show a bullet next to each element. That is, a normal list appears like this:

  • text A
  • text B
  • text C

I want my list to appear like this:

text A
text B
text C

Pasturage answered 26/1, 2010 at 13:13 Comment(0)
P
21
ul { list-style: none; }

That gets rid of the bullet points. Now you can go ahead and assign styles to space them out like in your example, if that's what you really wanted:

li { padding: 5px 0; }

If you also don't want the list indented after removing the bullets, it will take another bit, like this:

ul {
   list-style: none;
   margin: 0;
   padding: 0;
}

If you dont set both margin and padding to 0, it will either look right in FF or IE, but not both

Pareu answered 26/1, 2010 at 13:15 Comment(0)
C
3

Use

list-style:none;

in the style for the < ul > tag

Charmain answered 26/1, 2010 at 13:15 Comment(0)
K
3

Alternatively, you can also use a definition list (dl, dt, dd) without definition terms (dt elements).

<dl>
    <dd>text A</dd>
    <dd>text B</dd>
    <dd>text C</dd>
</dl>

But semantically I think an unordered list (ul, li) suits your particular purpose better :) So go ahead with just a piece of good CSS as explained by Erik.

Krugersdorp answered 26/1, 2010 at 15:3 Comment(1)
Very interesting! Never heard of those tags before. Thanks!Pasturage
Z
0
<ul style="list-style-type:none"></u>

By setting the style type to none the bullets will not show.

Zeitgeist answered 21/3, 2016 at 19:51 Comment(0)
M
-1

list-style-type: upper-roman;

Magulac answered 26/1, 2010 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.