I want to keep the aspect ratio and display the block elements so that they fit in the display area.

Asked 1 years ago, Updated 1 years ago, 40 views

It's just like the title.
For example, if you want to display a 2:3 box
It is easy to change the size to match the width of the browser while maintaining the aspect ratio.
Depending on the height of the browser, the scroll bar will not be able to enter the screen.

Instead,
like background-size:contain; I want the block elements to be displayed so that they can fit in the display area while maintaining the aspect ratio.
Is it possible to display like this?

I've tried various things and searched for them, but only the former information comes out, so
If there is a way, please let me know.Thank you for your cooperation.

jquery css

2022-09-29 21:23

1 Answers

object-fit:contain and max-height if necessary.


2022-09-29 21:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.