zackaria_asks
zackaria_asks

Reputation: 59

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

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

Upvotes: 0

Views: 2291

Answers (3)

thisisnabi
thisisnabi

Reputation: 1200

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%
}

Upvotes: 0

Javier Pérez
Javier Pérez

Reputation: 151

try this

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

Upvotes: 1

Bjorn Code
Bjorn Code

Reputation: 5

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

Upvotes: 0

Related Questions