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
ἔρως
ἔρως9mo 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
Matt9mo ago
I tried version with ::before
Matt
Matt9mo ago
No description
ἔρως
ἔρως9mo ago
add some padding on the left, to the <li> and see if it works
Matt
Matt9mo ago
Well. Li has position relative, Icon has absolute Offset made to Li also happens to icon
ἔρως
ἔρως9mo 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
Matt9mo 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?
ἔρως
ἔρως9mo 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
Matt9mo ago
I'm not asking how to do it, just curious if its possible without JS okay ty
ἔρως
ἔρως9mo ago
i know, don't worry you're welcome one of the things i said should work
MarkBoots
MarkBoots9mo 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
ἔρως
ἔρως9mo ago
which is the very first suggestion ive made