Make an image fit its container by setting the image height to the containers heights

前端 未结 2 1721
没有蜡笔的小新
没有蜡笔的小新 2021-01-19 09:32

Say I have container.a and it has some height in pixels, say I have another container.b within container.a that is 80% of container.a, now say I want to fit an image that ha

相关标签:
2条回答
  • 2021-01-19 09:57

    Use this:

    .image.a { height:100%; width:auto }
    
    0 讨论(0)
  • 2021-01-19 10:20

    Give 100% width of image

     .image.a{width:100%;}
    
    0 讨论(0)
提交回复
热议问题