Skip to content

Instantly share code, notes, and snippets.

@joseadrian
Created February 5, 2013 21:20
Show Gist options
  • Save joseadrian/4717759 to your computer and use it in GitHub Desktop.
Save joseadrian/4717759 to your computer and use it in GitHub Desktop.
Cross browser vertical aligment. From: http://csscreator.com/node/20471
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<style type="text/css" media="screen">
#container{ height: auto; min-height: 100%; }
</style>
</head>
<body>
<div id="container">
<div id="wrapper">
<p>Not much going on here!</p>
</div>
</div>
</body>
</html>
html,
body
{
height: 100%;
}
#container
{
position: relative; /*** Let's be nice to IE ***/
width: 200px; /*** Content Width ***/
margin: 0 auto;
display: table; /*** For non-IE browsers ***/
height: 100%;
background: #FFCCCC; /*** Background color of content section ***/
}
#wrapper
{
display: table-cell; /*** For non-IE browsers ***/
position: relative; /*** Let's be nice to IE ***/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment