Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retina asset for list-style-image

Does anyone know a great way to have a custom list-stlye-image for retina displays? The usual background-size trick in a media query doesn't work for list-style-image.

like image 843
Phil Avatar asked Aug 21 '12 16:08

Phil


People also ask

What type of image can be used for list item marker?

The list-style-image CSS property sets an image to be used as the list item marker. It is often more convenient to use the shorthand list-style .

How do I change the size of a list-style-image in CSS?

In the above output image, users can see the difference between the size of the list-style-image when we set sizes 30px and 10px. Approach 2: In this approach, we will set the image size by using the background-size property for the <li> element.

How do I optimize images for retina display?

To accommodate high resolution/retina displays, you'll want to use an image that's 1280 pixels wide, which is what's referred to as “2x”. While the graphic will still display on the website at 640 pixels wide, you are doubling the pixel density by using an image that's double the size.

How do you create a retina image?

To create a bitmap Retina image you need to take a larger image, with double the amount of pixels that your image will be displayed at (200 x 200 pixels), and set the image to fill half of that space (100 x 100 pixels).


1 Answers

The best way to achieve this is to not use the list-style-image, but instead set a background-image for each li element in the list.

This way you can use the usual background-size tricks to allow for retina displays.

like image 129
ChazUK Avatar answered Sep 20 '22 09:09

ChazUK