Skip to content

Instantly share code, notes, and snippets.

@dwoodard
Last active January 4, 2016 09:58
Show Gist options
  • Save dwoodard/8605138 to your computer and use it in GitHub Desktop.
Save dwoodard/8605138 to your computer and use it in GitHub Desktop.
CSS Layout Floats, Position
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display: block; } body {line-height: 1; } ol, ul {list-style: none; } blockquote, q {quotes: none; } blockquote:before, blockquote:after, q:before, q:after {content: ''; content: none; } table {border-collapse: collapse; border-spacing: 0; }
</style>
<link rel="stylesheet" href="http://cachedcommons.org/cache/960/0.0.0/stylesheets/960.css">
<style>
html,body{height: 100%}
html{
/*background: blue;*/
}
body{
/*background: yellow;*/
}
#container{
width: 960px;
height: 900px;
outline: 1px solid;
margin: 10px auto 0;
position: relative;
}
#container2{
width: 480px;
outline: 1px solid;
margin: 10px auto 0;
/*position: relative;*/
}
.box{
float: left;
display: block;
width: 220px;
margin: 0 10px;
background: red;
height: 100px;
}
.box1, .box2{
display: block;
width: 220px;
height: 100px;
}
.box1{
background: red;
}
.box2{
background: green;
}
.box1{
}
.box2{
position: absolute;
top:0;
right: 0px
}
/*.container_12{
outline: 1px solid red;
}*/
</style>
</head>
<body>
<div class="box1">box1</div>
<div class="box2">box2</div>
<div id="container" class="">
<div class="box1">box1</div>
<div class="box2">box2</div>
<div id="container2" class="">
<div class="box1">box1</div>
<div class="box2">box2</div>
</div>
</div>
<br>
<div class="box">hey</div>
<br>
<div id="container" class="clearfix">
<div class="box">box1</div>
<div class="box">box2</div>
<div class="box">box3</div>
<div class="box">box4</div>
<div class="box">box5</div>
<div class="box">box6</div>
<div class="box">box7</div>
<div class="box">box8</div>
</div>
<br>
<br>
<br>
<br>
<div class="container_12 clearfix">
<div class="grid_3">hey</div>
<div class="grid_3">hey</div>
<div class="grid_3">hey</div>
<div class="grid_3">hey</div>
<div class="grid_3">hey</div>
<div class="grid_3">hey</div>
<div class="grid_3">hey</div>
<div class="grid_3">hey</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment