How do I scale an SVG background-image without honoring aspect ratio in Firefox?

前端 未结 2 1956
太阳男子
太阳男子 2021-02-19 11:46

I\'ve got a CSS background-image set on an element of fluid height and width. It\'s an SVG, and the intended behavior is for it to stretch in whatever directions ne

2条回答
  •  無奈伤痛
    2021-02-19 11:50

    I needed to set the background-size. This snippet did the trick:

    background-size: 100% 100%;
    

    Part of the "stricter rendering model" was deferring sizing information to the page, rather than intrinsically within the SVG.

    I thought I was defining this inside the background shorthand, but apparently instead I was specifying the background-position. I feel pretty silly about that, but it does appear to be the gnarliest and most-overgrown shorthand in CSS.

提交回复
热议问题