+ 5

css custom bullets position

i have set li{ list-style-type:noe } /*custom sign for list item*/ li::before{ content:'\2618'; display:inline-block; } but when i run it . custom conten is not aligned with the list item check out this code: https://code.sololearn.com/Wao18gdsAVQm/#

14th Aug 2018, 10:15 AM
Amir Ahmad
Amir Ahmad - avatar
8 Respostas
0
Side note: You should put something in the actual list item outside of the pre tag to be able to see the inline-block/vertical-align fix work more clearly. Right now, all your text is contained in the pre tag, which has its own formatting. I would personally make it a habit to set all the margins of the elements I plan on using to zero, or, in the least, set the top and bottom margins of pre to zero.
14th Aug 2018, 10:59 AM
Janning⭐
Janning⭐ - avatar
+ 3
Janning⭐ Either this is not working
14th Aug 2018, 10:23 AM
Amir Ahmad
Amir Ahmad - avatar
+ 3
Janning⭐ i have added now in my code. and i had tried this before but it didn't work.
14th Aug 2018, 10:25 AM
Amir Ahmad
Amir Ahmad - avatar
+ 1
Try pre { display: inline; } then use padding and vertical align in li to adjust accordingly. vertical-align can only work on parent with inline display so that its parent has base line it can to refer to.
14th Aug 2018, 10:55 AM
Calviղ
Calviղ - avatar
0
For your li::before, you will want to display: inline-block; so that you can use vertical-align on it to adjust.
14th Aug 2018, 10:21 AM
Janning⭐
Janning⭐ - avatar
0
I don't see the vertical-align part in your code.
14th Aug 2018, 10:24 AM
Janning⭐
Janning⭐ - avatar
0
Did you save it after you added the vertical-align? I still don't see it.
14th Aug 2018, 10:37 AM
Janning⭐
Janning⭐ - avatar
0
Vertical-align works fine when the parent is not inline. Lists are cases in point. <li> is the parent and has display: list-item; by default. li::before and pre are both children of li. But yes, you would want siblings to be either inline or inline-block.
14th Aug 2018, 11:35 AM
Janning⭐
Janning⭐ - avatar