maybe someone knows a good way to align the text on one line and shift the icon to the left
Apply position: absolute
to the pseudo-element
::before
and use the positioning value left
to position it however you like. left: 0
will position it as far away to the left as possible (on top of the <li>
in this case), so just use a negative value to put it further to the left. Remember to apply position: relative
on the <li>
-element as well, so the ::before
-element is positioned absolute
relatively to the <li>
-element.
ul { list-style-type: none; margin: 0; }.element { position: relative; }.element::before { content: '+'; position: absolute; left: -15px; top: 0; }
<ul> <li>text</li> <li class="element">text</li> <li>text</li> </ul>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.