r/HTML • u/Ashk3000 • Sep 20 '26
Putting an unordered list inside a paragraph??
Why doesn't this work?? Like ik the specs prohibit it but why would they do that? there are valid reasons to want to do this. For example I have a list of long descriptions so to make it easier to read I wanted to use a vertical list. It would be very confusing to split the paragraph.
If anyone is in the same situation as me I think the best alternative is to use a span with css that makes it look like a list.

0
Upvotes
16
u/DirtAndGrass Sep 20 '26
Because paragraphs don't have bullet points in them? Not in HTML, not in English, not in other languages that I know of.
Paragraphs don't have extra whitespace, they are contiguous and continuous text.
14
u/notepad987 Sep 20 '26 edited Sep 22 '26
In standard HTML, placing an unordered list (<ul>) inside a paragraph (<p>) is invalid HTML.
Browsers will automatically close the <p> tag when they encounter a block-level element like <ul>.
Corrected to what OvenActive posted
Codepen workaround
8
u/nonchip Sep 20 '26
because that's a single line paragraph followed by a list. how do you even imagine that'd work?
7
u/SamIAre Sep 20 '26
How would you want a screenreader to interpret it? As an actual ordered list it would read as a paragraph fragment and then a separate list, even if you were able to embed the list in the paragraph.
Screenreaders announce lists, the number of items and let users navigate that list. To me, this seems more like a purely stylistic way to present just a normal sentence with what would otherwise be a comma-delineated list. So IMO, unless you want actual list behavior and just want bullets and line breaks, I would emulate a list in CSS without an actual unordered list element.
3
u/pfdemp Sep 20 '26
I wonder if OP is just concerned about how it looks with the space between the text and the list? This can be modified with some CSS.
2
u/OvenActive Expert Sep 22 '26
What you are trying to do:
What you want to do:
2
u/lbunch1 Sep 20 '26
I get what you are saying semantically, but how do you envision it rendering without in a way "splitting" the paragraph?
If it bothers you that much, just use a div in place of the p tag I guess.
1
u/the-liquidian Sep 21 '26
You should probably use the original p tag with ul with css. If the gap is too large just live with it, it’s probably a good idea to have it.
1
u/LowLevelUser Sep 21 '26
Maybe finish the paragraph first, then throw the bullet points underneath it.