How to make all list item categories have the same width while keeping bullets and aligning wrapped
I have a
<ul>
with bullet points. Each <li>
contains a category (e.g., “Category 1:”) and then a list of items.
I want to:
1. Keep the default round bullet points (<li> markers).
2. Give all categories the same minimum width so they line up nicely.
3. Make sure that when the text wraps, the second line starts under the first item text, not under the category label.
Problem:
* I can give the .category
a fixed width with CSS, but then the wrapped lines still align under the category instead of starting under the first item text.
* Also, I’ve tried using display: grid
or flex
on the <li>
, but that often removes the bullet points.
Question:
How can I style this list so that:
* Bullets are visible
* All categories have the same width
* Wrapped lines start under the first item’s text, not the category label

12 Replies
this really looks (content wise) like a nested list
do you want the items to have their own bullets, or is the comma separated list intentional?
Yes, the comma separated list is intentional . I want all items to stay in a single line (wrapping if necessary) rather than giving each item its own bullet point.
like this ? https://codepen.io/MannixMD/pen/EaVoxMr
Thank you very much. Only the bullet points are missing.
I agree with Jochem in that, in terms of content, this should probably be a nested list.
As for why the bullet point (marker) is removed, this is because you are replacing the default
display:list-item
with display: flex
. So, as it is now not a list, the list-style marker is no longer rendered.
If you want the bullet, you will then need to create a custom bullet/marker and add it as a pseudo element.
I would probably do it something like this:
I was trying to see if you could use
display-inside
and display-outside
to preserve both the list-item
and grid
types, but you can't combine list-item
with grid
cause it's a display-inside
typewith the current html, you could also do

sticking that
display: list-item
on the first span is super clever!yea, it even works with <ol>
I agree! I will have to remember that trick for CSSbattles 😉
don't see when to use that (but that's a different topic)
Thank you very much all of you 🙏