How To Add List-style-type: “disc” to

tag

2019-02-08 11:54发布

问题:

This seems like it ought to be ridiculously easy, but I'm having trouble figuring it out.

I want to replicate the <li> function so the disc image appears to the left, but applied to a

tag

I have this, but it does not show the disc image.

.list {
     margin-top: 15px;
     margin-bottom: 15px;
     list-style:disc outside none;
     display:inline; 
     }

<p class="list"><em>And Much, Much More!</em></p>

I want to avoid using any graphics to simulate the bullet if at all possible.
Thanks for the help

回答1:

Answer: display: list-item;

Display must be set to list-item - not inline, and not list!

.list {
     list-style:disc outside none;
     display:list-item; 
     }

<p class="list"><em>And Much, Much More!</em></p>


回答2:

Well, a p is not a list. Why not use <ul><li>?

[edit] Let me elaborate. The problem is that you set this style on a list, while the disc is shown in the list items. A p has no items in that sense, so there's nothing to apply the disc to.