Scale image with css to both width and height to scale

后端 未结 7 1972
孤街浪徒
孤街浪徒 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:50

    I think this A List Apart article may help you greatly, it discusses responsive images that adapt to their container, maintaining aspect ratio.

    Essentially you just need to contain the and specify dimensions for that container than apply max-width:100% to the and it will adapt. Read the rest of the article for obligitary IE considerations (thankfully IE7+ supports it).

提交回复
热议问题