Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added clearfix() #3

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib/nib/clearfix.styl
@@ -0,0 +1,23 @@

/*
* The Magnificent CLEARFIX.
*
* Useful for clearing floats without structural markup. This specific
* clearfix method also prevents margin-collapsing on child elements.
*
* See http://j.mp/bestclearfix
*
*/

clearfix()
&:before,
&:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden;
}
&:after {
clear: both;
}
zoom: 1;
13 changes: 13 additions & 0 deletions test/cases/clearfix.css
@@ -0,0 +1,13 @@
#clearfix {
zoom: 1;
}
#clearfix:before,
#clearfix:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden;
}
#clearfix:after {
clear: both;
}
5 changes: 5 additions & 0 deletions test/cases/clearfix.styl
@@ -0,0 +1,5 @@

@import 'nib/clearfix'

#clearfix
clearfix()
12 changes: 12 additions & 0 deletions test/clearfix.styl
@@ -0,0 +1,12 @@

@import 'nib/clearfix'

#clearfix
clearfix()
background-color: green
padding: 5px

#clearfix div
background-color: blue
width: 30%
float: left
14 changes: 11 additions & 3 deletions test/index.jade
@@ -1,9 +1,10 @@
html
head
head
title Nib
link(rel='stylesheet', href='/test.css')
link(rel='stylesheet', href='/gradients.css')
link(rel='stylesheet', href='/buttons.css')
link(rel='stylesheet', href='/clearfix.css')
script(src='/jquery.min.js')
script
$(function(){
Expand Down Expand Up @@ -38,12 +39,19 @@ html
td hover
- each name in names
td: input(type='button', value=name, class=name).hover
tr
tr
td active
- each name in names
td: button(class=name).active= name
tr
td focus
- each name in names
td: button(class=name).focus= name

h2 Clearfix
div#clearfix
div
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut commodo
| turpis quis mauris tempus commodo a non tellus. Sed eu convallis
| mauris. Donec scelerisque lacus quis orci viverra tincidunt. Nunc sed
| risus lectus. Proin vulputate elit sed eros consectetur interdum.
| Suspendisse potenti.