Dynadot โ€” .com Registration $8.99

Height: 100% with margin: auto ?

Spaceship Spaceship
Watch

VaporAction

Established Member
Impact
0
I'm trying to make a page with margin: auto; so that it's always centered and I want the page to continue to the bottom of the browser so I set the height to 100%...
problem is that height: 100% only works with position: absolute but margin: auto only works with position: relative...
anybody know how to do this?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
height: 100% doesn't technically exist. The way most do it is to create a background image that mimics the current background and then use repeat-y to make it stretch to the bottom.
 
0
•••
Agreed with Matthew, although height:100% may work on some browsers its really not compatible and not W3 compliant. Really depending on what you need it for there are various work arounds.
 
0
•••
height: 100%; works if you set all containing blocks between the target div and the browser window to height: 100%; meaning that you have to set ....

html {height: 100%}
body {height: 100%}
div {height: 100%}

however, I would like the page to be fully standards-compliant...
is height: 100%; really not compliant and if not, what would be a better method?
 
0
•••
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back