Home > Web Front-end > CSS Tutorial > css control small icon before text

css control small icon before text

高洛峰
Release: 2016-11-24 11:22:35
Original
1998 people have browsed it

Some list items need to add a small icon before the text, as shown below:

css control small icon before text

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]   m.sbmmt.com
<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>
Copy after login

Padding-left is used here to realize the appearance of this small icon, which is to make the text click to the right


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template