Changed standard +clearfix to use overflow: hidden.
Added alternate +pie-clearfix using content :after
This commit is contained in:
parent
150e7bf6a7
commit
d9416f65fa
@ -84,3 +84,18 @@ h2
|
|||||||
+float-left
|
+float-left
|
||||||
.float-right-example
|
.float-right-example
|
||||||
+float-right
|
+float-right
|
||||||
|
.pie-clearfix-example
|
||||||
|
:background #ddd
|
||||||
|
:border 2px solid black
|
||||||
|
:text-align center
|
||||||
|
:position relative
|
||||||
|
+pie-clearfix
|
||||||
|
.positioned-example
|
||||||
|
:display block
|
||||||
|
:position absolute
|
||||||
|
:left -10px
|
||||||
|
:top -10px
|
||||||
|
:font-size 10px
|
||||||
|
:width 10em
|
||||||
|
:background #ccf
|
||||||
|
:border 1px solid black
|
||||||
|
@ -138,18 +138,23 @@
|
|||||||
%th Totals
|
%th Totals
|
||||||
%td.numeric.even 15.5
|
%td.numeric.even 15.5
|
||||||
%td.numeric.odd 16.0
|
%td.numeric.odd 16.0
|
||||||
%td.numeric.even 17.5
|
%td.numeric.even 17.5
|
||||||
#floats
|
#floats
|
||||||
.example
|
.example
|
||||||
%h2 Floats
|
%h2 Floats
|
||||||
|
%p
|
||||||
|
The float helpers add fixes for the double-margin float
|
||||||
|
bug, so you don't need to remember.
|
||||||
%p
|
%p
|
||||||
Floated elements will extend beyond the bottom boundary of their
|
Floated elements will extend beyond the bottom boundary of their
|
||||||
parent container unless a
|
parent container unless a
|
||||||
%code.mixin +clearfix
|
%code.mixin +clearfix
|
||||||
is applied to the parent.
|
is applied to the parent.
|
||||||
%p
|
%p
|
||||||
The float mixins add fixes for the double-margin float
|
The regular
|
||||||
bug, so you don't need to remember.
|
%code.mixin +clearfix
|
||||||
|
method uses overflow:hidden. This is a simple and reliable way to
|
||||||
|
get your box wrapped around your float elements.
|
||||||
.clearfix-example
|
.clearfix-example
|
||||||
.float-left-example
|
.float-left-example
|
||||||
This div is styled with
|
This div is styled with
|
||||||
@ -161,3 +166,20 @@
|
|||||||
and it should be 20px from the right edge, even in IE6.
|
and it should be 20px from the right edge, even in IE6.
|
||||||
This div is styled with
|
This div is styled with
|
||||||
%code.mixin +clearfix
|
%code.mixin +clearfix
|
||||||
|
%p
|
||||||
|
An alternate clearing method is provided for when elements need
|
||||||
|
to be positioned to hang outside the box. This is based on the
|
||||||
|
\:after content method.
|
||||||
|
.pie-clearfix-example
|
||||||
|
.float-left-example
|
||||||
|
This div is styled with
|
||||||
|
%code.mixin +float-left
|
||||||
|
\. It is taller than its parent and it should be 20px from the left edge.
|
||||||
|
.float-right-example
|
||||||
|
This short div is styled with
|
||||||
|
%code.mixin +float-right
|
||||||
|
and it should be 20px from the right edge, even in IE6.
|
||||||
|
This div is styled with
|
||||||
|
%code.mixin +pie-clearfix
|
||||||
|
.positioned-example
|
||||||
|
Using this clear method, this positioned box is not cut off.
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
@import hacks.sass
|
||||||
|
|
||||||
|
//**
|
||||||
|
Extends the element to enclose any floats it contains.
|
||||||
|
This basic method is preferred for the usual case, when positioned content will not show outside the bounds of the container.
|
||||||
|
Recommendations include using this in conjunction with a width:
|
||||||
|
http://www.quirksmode.org/blog/archives/2005/03/clearing_floats.html
|
||||||
|
=clearfix
|
||||||
|
:overflow hidden
|
||||||
|
+has-layout
|
||||||
|
|
||||||
|
//**
|
||||||
|
Extends the element to enclose any floats it contains.
|
||||||
|
This older "Easy Clearing" method has the advantage of allowing positioned elements to hang outside the bounds of the container, at the expense of more tricky CSS.
|
||||||
|
http://www.positioniseverything.net/easyclearing.html
|
||||||
|
=pie-clearfix
|
||||||
|
&:after
|
||||||
|
:content " "
|
||||||
|
:display block
|
||||||
|
:height 0
|
||||||
|
:clear both
|
||||||
|
:overflow hidden
|
||||||
|
:visibility hidden
|
||||||
|
+has-layout
|
@ -1,14 +1,5 @@
|
|||||||
// Clearing floats without extra markup
|
//**\\
|
||||||
// Simple Clearing of Floats
|
Float
|
||||||
// [http://www.sitepoint.com/blogs/2005/02/26/simple-clearing-of-floats/]
|
|
||||||
=clearfix
|
|
||||||
:overflow auto
|
|
||||||
:overflow -moz-scrollbars-none
|
|
||||||
// This makes ie6 get layout
|
|
||||||
:display inline-block
|
|
||||||
// and this puts it back to block
|
|
||||||
&
|
|
||||||
:display block
|
|
||||||
|
|
||||||
// Implementation of float:left with fix for double-margin bug
|
// Implementation of float:left with fix for double-margin bug
|
||||||
=float-left
|
=float-left
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
=has-layout
|
||||||
|
// This makes ie6 get layout
|
||||||
|
:display inline-block
|
||||||
|
// and this puts it back to block
|
||||||
|
&
|
||||||
|
:display block
|
Loading…
Reference in New Issue
Block a user