Skip to content

Instantly share code, notes, and snippets.

@octavioamu
Created October 3, 2012 13:52
Show Gist options
  • Save octavioamu/3827026 to your computer and use it in GitHub Desktop.
Save octavioamu/3827026 to your computer and use it in GitHub Desktop.
An HTML5 Layout That Works in IE
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html>
<head>
<title>An HTML5 Layout That Works in IE</title>
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>
<![endif]-->
<style type="text/css">
/* Page-level */
body {
margin:0;
padding:0;
background:white;
font-family: Helvetica, Arial, sans-serif;
font-size:14px;
}
body:after{
content: "";
position: absolute;
top: 50%;
left: 50%;
background: red;
width: 300px;
height: 300px;
}
body:hover:after{ background: blue; }
#page {
width:1000px;
background:white;
border:1px solid black;
margin:auto;
padding:0;
}
/* Note: Make HTML 5 elements block-level for consistent styling */
header, nav, article, footer, address { display:block; }
/* Sections */
header, footer { width:100%; clear:both; }
header {
height:100px;
width:960px;
padding:20px;
background:black;
color:#ccc;
}
nav {
float:left;
width:210px;
margin:20px;
}
nav ul {
list-style:none;
list-style-type:none;
margin:0;
padding:0;
font-size:1.6em;
font-weight:bold;
}
nav ul li {
margin:5px;
}
#posts {
width:700px;
margin:20px 10px 10px 260px;
}
footer {
font-size:0.8em;
font-weight:bold;
text-align:center;
background:#ccc;
height:200px;
margin-top:25px;
padding-top:20px;
}
/* Content */
h1 { font-size: 4.5em; }
h2 { font-size: 2.0em; margin:0; }
h3 { font-size: 1.4em; margin:0; }
p { font-size: 1.0em; }
article {
border-bottom: 1px dashed gray;
margin-bottom: 20px;
}
article p{
padding:10px;
}
</style>
</head>
<body>
<div id="page">
<header>
<h1>HTML 5 Demo</h1>
</header>
<nav>
<ul id="links">
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
<div id="posts">
<article>
<hgroup>
<h2>Post 1</h2>
<h3>This one's first</h3>
</hgroup>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
</article>
<article>
<hgroup>
<h2>Post 2</h2>
<h3>This one's second</h3>
</hgroup>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
</article>
</div>
<footer>
<address>
<a href="mailto:[email protected]">Feedback</a>
</address>
<p>Copyright boilerplate</p>
</footer>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment