Scale image with css to both width and height to scale

后端 未结 7 1894
孤街浪徒
孤街浪徒 2021-01-12 05:07

The bounding box is approx 1000x600, and some images are 500x100, while some others are 400x100 (extreme examples). Now I\'d like to scale both up to the maximum size the bo

相关标签:
7条回答
  • 2021-01-12 05:59

    I don't know if there is a way to do this with just CSS. If you want to achieve something like this then you can use supersized

    Alternatively, if you don't care about older browsers, you can look into the CSS3 background-size property. Specifically, I think that setting background-size: cover will do the trick.

    Edit - I misunderstood. What you might actually want is background-size: contain, but the downside is that you probably will have to change your html markup, not just your css.

    0 讨论(0)
提交回复
热议问题