Jump to content

Set Height 100%


Nikolas96

Recommended Posts

Hi Guys.

in this code:

<div id="main">

<div id="inn"></div>

</div>
#main { height 100px; width:100%;}

if i set height of #inn to 100% it take 100px height off screen.

but i want to take 100% height of screen!

how to do it?

thanks.

Link to comment
Share on other sites

A child element using height: 100%; will take up the full height of parent using fixed height unit of px.

 

A outermost parent element using min-height: 100%; while the html and body element have 100% height as in

 

html, body { height: 100%; }

 

Will fill the browser screen height as as minimum, and will grow if content extends beyond browser window height.

 

You can also use height: 100vh; (100% of view port/browser window height), which will exaxt height of browser window, but will not extend with content.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...