How do I get the list-style-image picture vertically centered?

Source: Internet
Author: User
If you set a small icon in front of a list item using List-style-image, it is displayed normally under FF, and the List-style-image picture is centered vertically
If you use List-style-image to set a small icon in front of a list item, it is displayed normally under FF,

But in IE want to let him also center normal display, dead and alive not obedient.
Second, find a compromise solution,

is to use the UL Li Backgrou-image (background image) to solve.
As follows:

UL li{height:28px;/* The height of the list item */line-height:28px;/* The row height of the list item, the row height is the same as the Gao She, the text is centered vertically/text-indent:15px;/* Text indents 15 pixels, otherwise pressed to the chart */ Background-image:url (".. /images/icon.gif "); /* URL address for picture */Background-position:left 45%; /* location of Beijing Pictures * * background-repeat:no-repeat; /* Disable picture tiling, show one just fine */}


Firefox:li{background-position:left 50%)
Ie:li{background-position:left 45%)

Percentage please give it a try!

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: info-contact@alibabacloud.com 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.