I’m having an issue with bullet points not appearing in a list when I use display: flex on the parent element. Here’s a simplified example of my code:
ul li {
display: flex;
justify-content: space-between;
align-items: center;
}
<ul>
<li>
<div>Item 1</div>
<div>
<mat-icon>edit</mat-icon>
<mat-icon>delete</mat-icon>
</div>
</li>
</ul>
In this setup, the bullet points for each list item are not displayed. How can I fix this so that the bullet points appear as expected?
2
Answers
You can manually add a bullet point as shown above.
Using before will treat the bullet point as a seperate item and space it out because of the justify-content:space-between;
Therefore, we can make add a class called itemLabel to prevent this and then use the following css:
Note: the reason display:flex; is causing the bullet points to not display is because the display:list-item; (which is default for all li) is overruled (this property causes the bullet point to be displayed)
@userNameAsString is correct,
display: list-item
is overwritten bydisplay: flex
. Fortunately<li>
content can be anything (see flow content), so just wrap an element around each of the<li>
s’ content and make those the flexbox (ie the element withdisplay: flex
).