Align list-style-image

I'm having trouble maintaining alignment with list-style-image: url(imgs/icon-list.svg); Currently, the Icon exceeds the line-height (see attachment), causing the list items to be misaligned. I've tried to set height/width on the marker, but cannot get this resolved. Any ideas?
No description
12 Replies
ἔρως
ἔρως15mo ago
honestly, just pretend that ::marker doesn't exist, and use ::before then hide the ::marker ::marker only supports a very small subset of styles
Matt
MattOP15mo ago
I tried version with ::before
Matt
MattOP15mo ago
No description
ἔρως
ἔρως15mo ago
add some padding on the left, to the <li> and see if it works
Matt
MattOP15mo ago
Well. Li has position relative, Icon has absolute Offset made to Li also happens to icon
ἔρως
ἔρως15mo ago
then scrap everything, and set the li to have a display: flex then align everything vertically, and add a gap still using ::before or, just put the svg directly in the html, which is much easier to handle if you don't want that, try to set a background size however, the quality of the image may quickly turn into ass
Matt
MattOP15mo ago
okay going to see if i can incorporate one of these solutions just curious. If I'm using a form and want to prompt success page after clicking submit input. Does this need JS or can this be done with purely html/css?
ἔρως
ἔρως15mo ago
that should be in a different question, with a better explanation of what you want but from your quick description, seems like it needs javascript
Matt
MattOP15mo ago
I'm not asking how to do it, just curious if its possible without JS okay ty
ἔρως
ἔρως15mo ago
i know, don't worry you're welcome one of the things i said should work
MarkBoots
MarkBoots15mo ago
bit late, but a little tip, if you make the li a flex box, then the :before becomes a flex child. then you don't need to absolute position the marker and can jjust align it with the flex properties. and with flex-gap you can control the spacing. for example:
No description
ἔρως
ἔρως15mo ago
which is the very first suggestion ive made
Want results from more Discord servers?
Add your server