Skip to content

Instantly share code, notes, and snippets.

@arozwalak
Created November 27, 2013 10:24
Show Gist options
  • Save arozwalak/7673568 to your computer and use it in GitHub Desktop.
Save arozwalak/7673568 to your computer and use it in GitHub Desktop.
HTML5: Example2
/*
* Create HTML5 elements for IE's sake
* Reference: http://ejohn.org/blog/html5-shiv/
* Reference: http://remysharp.com/2009/01/07/html5-enabling-script/
*/
document.createElement("article");
document.createElement("footer");
document.createElement("header");
document.createElement("hgroup");
document.createElement("nav");
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html>
<head>
<title>An HTML5 Layout That Works in IE</title>
<link rel="stylesheet" href="css/main.css" type="text/css" />
<!-- <script type="text/javascript" src="js/CreateHTML5Elements.js"></script> -->
</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>
/* Page-level */
body {
margin:0;
padding:0;
background:white;
font-family: Helvetica, Arial, sans-serif;
font-size:14px;
}
#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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment