The small icon before the CSS controls the text

Source: Internet
Author: User
Some list items need to have a small icon in front of the text, such as:

There are many ways to implement this, using <span> elements here.

The span tag is a row element, not a wide height, although it can be changed by Display:block; But it will cause a newline.

Post code:

[HTML]<span style= "Padding-left:19px;background:url (a.jpg) no-repeat;" > Option 1</span>  <span style= "Padding-left:19px;background:url (a.jpg) no-repeat;" > Option 2</span>  <span style= "Padding-left:19px;background:url (a.jpg) no-repeat;" > Option 3</span>  <span style= "Padding-left:19px;background:url (a.jpg) no-repeat;" > Option 4</span>   <span style= "Padding-left:19px;background:url (a.jpg) no-repeat;" > Option 1</span><span style= "Padding-left:19px;background:url (a.jpg) no-repeat;" > Option 2</span><span style= "Padding-left:19px;background:url (a.jpg) no-repeat;" > Option 3</span><span style= "Padding-left:19px;background:url (a.jpg) no-repeat;" > Options 4</span>

Here the use of padding-left to achieve this small icon, is to let the text on the right point

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.