I've got a bit of an odd problem with my svg list-style-image in google chrome.
.services ul {
list-style-image: url('images/check.svg');
list-style-position: inside;
padding: 0;
margin: 0;
}
The image size is supposed to be 16px x 16px. But it appears way smaller, about half of the size. If I switch to png, the size is correct. In other browsers it seems allright.
Any ideas?
Resize the image. Use a background-image and padding instead (easiest method). Use an SVG without a defined size using viewBox that will then resize to 1em when used as a list-style-image (Kudos to Jeremy).
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 .
The list-style-image property replaces the list-item marker with an image.
Firstly, you need to create the List Item using a li list item tag. Within that List Item tag, you can place your image. You add an image within the Image tag img. Hope this helps explain it a bit better.
since you are calling the SVG image; you have to define SVG on your page as well. It is also mandatory to define the height
and width
as well in your SVG otherwise by default its take 1em
width and height if not mentioned.
<svg height="16px" width="16px" viewBox="0 0 16 16" version='1.1' xmlns='http://www.w3.org/2000/svg'>
</svg>
It would be better way to call the image by using background:url
this way a height
and width
can given to image, so the SVG image
could rendered properly.
.services li:before {
content:'';
display:inline-block;
height:1em;
width:1em;
background-image:url('images/check.svg');
background-size:contain;
background-repeat:no-repeat;
padding-left: 2em;
}
I had the same problem, especially with the size on iOs devices. I solved it by using a :before attribute
.services ul {
list-style: none;
padding: 0;
margin: 0;
}
.usp ul li:before {
content: url('images/check.svg');
width: 16px;
height: 16px;
margin-right: 10px;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With