Skip to content

Instantly share code, notes, and snippets.

@leandroruel
Last active August 29, 2015 13:56
Show Gist options
  • Save leandroruel/8994924 to your computer and use it in GitHub Desktop.
Save leandroruel/8994924 to your computer and use it in GitHub Desktop.
com o uso de CSS o código cria um container "seguidor" do conteúdo da página, o elemento vai do topo ao rodapé mesmo com pouco ou nenhum conteúdo.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*,
*::after,
*::before {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
/* this style is optional */
.header {
width: 100%;
height: 80px;
background-color: #df6225;
}
/* start our trick */
.put-to-center {
width: 1000px;
height: 100%;
margin: 0 auto;
background: rgba(0,0,0,0.7); /* this is optional only for example */
}
.following {
width: 1000px;
height: 100%;
display: table-cell;
}
.container {
width: 960px;
margin: 0 auto;
}
/* end trick */
/* this style is optional */
.footer {
width: 100%;
height: 50px;
background: #df6225;
}
p {
font-family: arial;
color: #fff;
}
</style>
</head>
<body>
<div class="header"></div>
<div class="put-to-center">
<div class="following">
<div class="container">
<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.
</p>
</div>
</div>
</div>
<div class="footer"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment