Skip to content

Instantly share code, notes, and snippets.

@georgeOsdDev
Created March 26, 2013 12:55
Show Gist options
  • Select an option

  • Save georgeOsdDev/5245153 to your computer and use it in GitHub Desktop.

Select an option

Save georgeOsdDev/5245153 to your computer and use it in GitHub Desktop.
Fixed Footer
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fixed Footer</title>
<meta name="description" content="fixed footer sample">
<link href="//cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="header">
<p>This is header</p>
</div>
<div class="main">
<h3>Main Contents</h3>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>10</p>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>10</p>
<h3>Main Contents</h3>
</div>
<div class="footer"><p>&copy;&nbsp;copyright</p></div>
</body>
</html>
body {
font-family: Helvetica;
font-size: 18px;
text-align: center;
vertical-align: middle;
margin: 0;
padding: 0;
}
.header{
background-color: blue;
width:100%;
position: fixed;
top: 0;
left: 0;
height:60px;
z-index:1000;
}
.main{
background-color: WhiteSmoke;
padding:60px 0 60px;
overflow: auto;
width:100%;
}
.footer{
background-color: red;
width:100%;
position: fixed;
bottom: 0;
left: 0;
height:60px;
z-index:1000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment