Scale image with css to both width and height to scale

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

    You can't do it like that. You can edit the image element's width and height attributes...

    
    Smiley face 
    
    
    Smiley face
    
    
    Smiley face 
    

    You can set the width and height to either pixels or percent. Note that you don't have to write px when using pixels, but you do have to write % when doing percentage. So you can do something like...

    Smiley face
    

    ... but that will take 100% of the width and height of the parent element. So be sure you know what the parent element is and its dimensions.

提交回复
热议问题