Changing ul bullet without changing ol bullets

Things I have tried

I’ve looked around and haven’t found a solution to this, but it should be simple. I know there’s a lengthy thread about changing child bullets, but nothing I tried there worked.

What I’m trying to do

I’m trying to find a way to change bullet points to dashes, and what I’m doing works, but it also changes the ordered lists to dashes and I’d like them to remain numbers.

Here’s what I’m doing:

li::marker {
    content: '- ';
}

I recognize that this is affecting every li item, but I’m not sure how to specify it to just affect ul li items. Is there a simple way to accomplish this? Just prepending a ul to it doesn’t work unfortunately. :confused:

Hello,

It looks like you’ve tried ul li::marker. Have you tried ul > li::marker, to help with specificity? It might be worth testing it by adding !important to the end of your style declaration, even though that’s generally not a great practice.

There’s also a sort of hackier workaround of setting ul li { list-style: none; } and setting a ::before with the content and margin that you want.

If Obsidian supports it, you can also define a custom list-style-type, which might be fun. See list-style-type - CSS: Cascading Style Sheets | MDN for more on that.

yeah. just for your understanding, li::marker is applicable for both <ul> and <ol>. if u want it to affect only the unordered list, the u may follow bost-ty recommendation.

Well, the classic “starts working when you show someone that it’s not working” happened, and ul > li works now when it didn’t earlier. Very weird. But thank you for the help!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.