#polyNedir ul li { position:relative;padding-left:20px }
#polyNedir ul li:after{font-family:fontawesome;content:'\f111';position:absolute;left:0px;top:3px;color:#fff;font-size:10px;}
ul {
list-style: none;
/* remove left padding, it's usually unwanted: */
padding: 0;
}
li:before {
content: url(icon.png);
display: inline-block;
vertical-align: middle;
/* If you want some space between icon and text: */
margin-right: 1em;
}
上面的代码和我的大多数情况一样。
为了精确的调整,你可以修改 vertical-align,例如:
vertical-align: top;
/* or */
vertical-align: -10px;
/* or whatever you need instead of "middle" */
ul {
/* Remove default list icon */
list-style: none;
padding: 0;
/* Small width and margin to demonstrate the text wrapping */
width: 200px;
border:1px solid red;
}
li{
/* Make sure the text is properly wrpped (not spilling in the image area) */
display: flex;
}
li:before {
content: url(https://via.placeholder.com/10/0000FF/808080/?text=*);
display: inline-block;
vertical-align: middle;
/* If you want some space between icon and text: */
margin-right: 2em;
}