Skip to content

Instantly share code, notes, and snippets.

@joseadrian
Created March 19, 2013 15:30
Show Gist options
  • Save joseadrian/5197076 to your computer and use it in GitHub Desktop.
Save joseadrian/5197076 to your computer and use it in GitHub Desktop.
Posicionar elemento al centro horizontal y verticalmente
* {margin: 0;padding: 0}
html,body {height: 100%}
#table {
height: 100%;
display: table;
width: 100%;
}
#cell {
display: table-cell;
vertical-align: middle;
}
#content {
width: 960px;
background: #3d3d3d;
margin: 0 auto;
}
/* <!--[if lte IE 7]> */
#ie-container {
position: relative;
float: left;
top: 50%
}
#content{
top: -50%;
position: relative;
}
/* <![endif]--> */
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div id="table">
<div id="cell">
<div id="ie-container">
<div id="content">
<p>Contenidot</p>
</div>
</div>
</div>
</div>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment