Home >Web Front-end >CSS Tutorial >css control small icon before text
Some list items need to add a small icon before the text, as shown below:
There are many ways to implement it, here the element is used.
The span tag is a line element and has no width and height, although it can be changed through display:block;. But it will cause line breaks.
Posted code:
[html] www.php.cn <span style="padding-left:19px;background:url(a.jpg) no-repeat;">选项1</span> <span style="padding-left:19px;background:url(a.jpg) no-repeat;">选项2</span> <span style="padding-left:19px;background:url(a.jpg) no-repeat;">选项3</span> <span style="padding-left:19px;background:url(a.jpg) no-repeat;">选项4</span> <span style="padding-left:19px;background:url(a.jpg) no-repeat;">选项1</span> <span style="padding-left:19px;background:url(a.jpg) no-repeat;">选项2</span> <span style="padding-left:19px;background:url(a.jpg) no-repeat;">选项3</span> <span style="padding-left:19px;background:url(a.jpg) no-repeat;">选项4</span>
Padding-left is used here to realize the appearance of this small icon, which is to make the text click to the right