CSS list-style-image size

后端 未结 11 1407
离开以前
离开以前 2020-12-02 10:24

I\'m trying to set custom SVG icons with CSS on a

    \'s list items. Example:

11条回答
  •  爱一瞬间的悲伤
    2020-12-02 10:49

    You can see how layout engines determine list-image sizes here: http://www.w3.org/wiki/CSS/Properties/list-style-image

    There are three ways to do get around this while maintaining the benefits of CSS:

    1. Resize the image.
    2. Use a background-image and padding instead (easiest method).
    3. 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).

提交回复
热议问题