Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

is there a CSS attribute that makes a too big object fit the screen?

For instance, I have a div, that is 10 000px by 10 000px and I want it to fit on any screen, like its height and width would be 10 000px and not just 100%, but the scroll bar wouldn’t be there and I wouldn’t be able to scroll until the div‘s bottom and right side

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Wrap the div in another div. Give the wrapping div overflow: hidden; and max-height of maybe 100vh if that’s what your going for.

.out {
    overflow: hidden;
    height: 100vh;
}

.in {
    width: 10000px;
    height: 10000px;
    background-color: red;
}

Example: https://jsfiddle.net/p2c76y1s/1/

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading