NameSilo

Height: 100% with margin: auto ?

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
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
Close
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
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back