Skip to content

Instantly share code, notes, and snippets.

Created July 5, 2014 04:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Float Demo
* Float Demo
html {
font-family: sans-serif;
font-size: 150%;
color: #666;
.container {
border: 1px solid #ccc;
p {
border: 1px solid black;
.float {
border: 1px solid red;
width: 130px;
height: 70px;
text-align: center;
color: blue;
background: #ffeeee;
float: right; /* implicit display: block*/
.box1 {
float: left;
.box2 {}
.box3 {}
.box4 {}
.p1 {}
.p2 {}
<div class="container">
<span class="float box1">1</span>
<p class="p1">P1 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
<div class="float box2">2</div><div class="float box3">3</div><div class="float box4">4</div>
<p class="p2">P2 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>
// alert('Hello world!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment