What's the best way to make an element of 100% minimum height across a wide range of browsers ? In particular if you have a layout with a header and footer of fixed height how do you make the middle content part fill 100% of the space in between with the footer fixed to the bottom ?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- Adding a timeout to a render function in ReactJS
I am using the following one: CSS Layout - 100 % height
Works fine for me.
Here is another solution based on
vh
, orviewpoint height
, for details visit CSS units. It is based on this solution, which uses flex instead.You may find more information here:
just share what i've been used, and works nicely
You can try this: http://www.monkey-business.biz/88/horizontal-zentriertes-100-hohe-css-layout/ That's 100% height and horizontal center.
As mentioned in Afshin Mehrabani's answer, you should set body and html's height to 100%, but to get the footer there, calculate the height of the wrapper:
First you should create a
div
withid='footer'
after yourcontent
div and then simply do this.Your HTML should look like this:
And the CSS: