How do I resize an image while keeping the aspect ratio in CSS?

后端 未结 4 1778
半阙折子戏
半阙折子戏 2020-12-16 10:17

I have a large image. I want to display it on its on own a web page, and when doing this without any CSS it fills the whole page and is too big to display at once (scroll ba

4条回答
  •  时光取名叫无心
    2020-12-16 10:40

    I think you need to paste a class inside the image you want to show like this

    < image  class="image" >  
    

    and this is the class

    .image 
    
    
     text align: center
     max width:pixels you want
     max height pixels you want
    

    but make sure that both are the same quantity that way wont get out of the screen in height and width.

    or you can play with the width and the height

提交回复
热议问题