Home > Net >  How to set <body> size? (Height & Width)
How to set <body> size? (Height & Width)

Time:05-29

I was wondering how I could set up the body tag in CSS so that the "max-height" of the body where I'm adding new elements is right below the navbar (which is 100% x 35px) so that when I add new elements for example it automatically loads in the defined area instead of where it usually does because now there's the navbar (look top left corner). enter image description here

CodePudding user response:

body{
  height: 100vh;
  width: 100%
}

CodePudding user response:

try this

body {
      min-height: calc(75vh - 50px);
      width: 100%
}

CodePudding user response:

you can use vh postfix on height.

Represents a percentage of the height of the viewport's initial containing block. 1vh is 1% of the viewport height. For example, if the viewport height is 300px, then a value of 70vh on a property will be 210px.

body{
  height: 100vh;
  width: 100%
}
  • Related