how can i push list style image down? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i push list style image down?

hi i have a list `ul li` and i have set image for it's style. `list-style-image` but i want the image's position vertically. it should go more down code: https://jsfiddle.net/zj2x70Lz/ tnx in advance

20th Sep 2017, 8:07 PM
Mohammad Moallemi
Mohammad Moallemi - avatar
1 Answer
+ 1
Alot of places I looked seem to suggest fiddling with background and padding in order to make something that looks the same. https://stackoverflow.com/questions/1708833/adjust-list-style-image-position I did think of an alternative though, most of the time the bullet will move with the text, so if you reposition the list items the bullet moves too (Which I imagine you found out) If you wrap the text inside the <li> tags in <span> tags however ( Like <li><span>Text</span></li>> you can reposition just the text using relative positioning, which should be fine for a static page. Put the text in span tags and add the following to your css and it should be fine. (Forgive the lack of indenting) ul li span { position: relative; top: -5px; } Note: I can't decide if -4px or -5px is better, just try both and see which looks right to you. Also, if you plan on using span tags in unordered lists anywhere else in your page, give them a class so they dont inherit this positioning. Hope this helps!
20th Sep 2017, 9:02 PM
JoeJoe