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

Time:10-24

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

CodePudding user response:

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/

CodePudding user response:

Try playing with position: absolute and overflow: visible

.div-class {
    height: 10000px;
    width: 10000px;
    position: absolute; //disconnect the element from ather components
    //top, bottom, left, right used to position the absolute element
    top: X;
    bottom: X;
    left: X;
    right: X;
    overflow: visible; //disable the scroll
}
  • Related