Vertically center list-style-image Images

Source: Internet
Author: User

List-style-image vertical center
If you use list-style-image to set a small icon in front of a list item, it is displayed normally under ff,

However, in IE, I want to make the display center normal, and I am not obedient.
Second, I found a compromise solution,

It is solved by using ul Li's backgrou-image (background image.
As follows:

 

CSS list-style-image Center Method

 Ul Li {
Height: 28px;/* Height of the list item */
Line-Height: 28px;/* The Row Height of the list item. The Row Height and height are set to the same, and the text is vertically centered */
Text-indent: 15px;/* indent the text by 15 pixels. Otherwise, the text is pressed to the chart */
Background-image: URL ("../images/icon.gif");/* URL of the image */
Background-position: Left 45%;/* positioning of Beijing images */
Background-repeat: No-Repeat;/* disable image tiled display */
}

 

 

 

Firefox: Li {background-position: Left 50%)
IE: Li {background-position: Left 45%)

The specific data value must be unique.

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.