[Compass Core] The has-layout mixin has been updated to emit less css.

It now uses a hacked zoom property to target ie6 and 7 only so that they
gain layout. If you prefer an approach that validates, set:

    $default-has-layout-approach: block;

and the has-layout mixin behavior will remain unchanged.
This commit is contained in:
Chris Eppstein 2010-07-25 11:39:11 -07:00
parent 0aedf01375
commit 922fc8c1a2
6 changed files with 57 additions and 19 deletions

View File

@ -1,12 +1,32 @@
// The `zoom` approach generates less CSS but does not validate.
// Set this to `block` to use the display-property to hack the
// element to gain layout.
$default-has-layout-approach: zoom !default;
// This mixin causes an element matching the selector // This mixin causes an element matching the selector
// to gain the "hasLayout" property in internet explorer. // to gain the "hasLayout" property in internet explorer.
// More information on [hasLayout](http://reference.sitepoint.com/css/haslayout). // More information on [hasLayout](http://reference.sitepoint.com/css/haslayout).
@mixin has-layout { @mixin has-layout($using: $default-has-layout-approach) {
@if $using == zoom {
@include has-layout-zoom;
} @else if $using == block {
@include has-layout-block;
} @else {
@warn "Unknown has-layout approach: #{$using}";
@include has-layout-zoom;
}
}
@mixin has-layout-zoom {
*zoom: 1;
}
@mixin has-layout-block {
// This makes ie6 get layout // This makes ie6 get layout
display: inline-block; display: inline-block;
// and this puts it back to block // and this puts it back to block
& { & { display: block; }
display: block; } } }
// A hack to supply IE6 (and below) with a different property value. // A hack to supply IE6 (and below) with a different property value.
// [Read more](http://www.cssportal.com/css-hacks/#in_css-important). // [Read more](http://www.cssportal.com/css-hacks/#in_css-important).

View File

@ -0,0 +1,17 @@
.clearfix {
overflow: hidden;
display: inline-block; }
.clearfix {
display: block; }
.pie-clearfix {
display: inline-block; }
.pie-clearfix:after {
content: "\0020";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden; }
.pie-clearfix {
display: block; }

View File

@ -4,9 +4,7 @@ ul.horizontal {
border: 0; border: 0;
outline: 0; outline: 0;
overflow: hidden; overflow: hidden;
display: inline-block; } *zoom: 1; }
ul.horizontal {
display: block; }
ul.horizontal li { ul.horizontal li {
list-style-image: none; list-style-image: none;
list-style-type: none; list-style-type: none;
@ -27,9 +25,7 @@ ul.wide-horizontal {
border: 0; border: 0;
outline: 0; outline: 0;
overflow: hidden; overflow: hidden;
display: inline-block; } *zoom: 1; }
ul.wide-horizontal {
display: block; }
ul.wide-horizontal li { ul.wide-horizontal li {
list-style-image: none; list-style-image: none;
list-style-type: none; list-style-type: none;
@ -50,9 +46,7 @@ ul.right-horizontal {
border: 0; border: 0;
outline: 0; outline: 0;
overflow: hidden; overflow: hidden;
display: inline-block; } *zoom: 1; }
ul.right-horizontal {
display: block; }
ul.right-horizontal li { ul.right-horizontal li {
list-style-image: none; list-style-image: none;
list-style-type: none; list-style-type: none;

View File

@ -1,11 +1,9 @@
.clearfix { .clearfix {
overflow: hidden; overflow: hidden;
display: inline-block; } *zoom: 1; }
.clearfix {
display: block; }
.pie-clearfix { .pie-clearfix {
display: inline-block; } *zoom: 1; }
.pie-clearfix:after { .pie-clearfix:after {
content: "\0020"; content: "\0020";
display: block; display: block;
@ -13,5 +11,3 @@
clear: both; clear: both;
overflow: hidden; overflow: hidden;
visibility: hidden; } visibility: hidden; }
.pie-clearfix {
display: block; }

View File

@ -0,0 +1,11 @@
$default-has-layout-approach: block;
@import "compass/utilities";
.clearfix {
@include clearfix;
}
.pie-clearfix {
@include pie-clearfix;
}