peteboere / css-crush

CSS preprocessor.
http://the-echoplex.net/csscrush
MIT License
537 stars 51 forks source link

Problem with Clearfix @mixin #62

Closed blickwert closed 10 years ago

blickwert commented 10 years ago

I hope you can help me. I want to add a clearfix @mixin. At the moment I use following code:

@mixin clearfix {
    zoom:1;
  &:before,
  &:after{
    content: " "; 
    display: table; 
  }

  &:after{
    display: block;
    clear: both;
    height: 1px;
    margin-top: -1px;
    visibility: hidden;
  }
}

My problem is that the :before and :after Pseudo-Element does'nt work.

Any ideas?

Thanks,Davelee

peteboere commented 10 years ago

If you're using the latest code you can do this, but you need to use @fragment not @mixin:

@fragment clearfix {
    zoom:1;
  &:before,
  &:after{
    content: " ";
    display: table;
  }

  &:after{
    display: block;
    clear: both;
    height: 1px;
    margin-top: -1px;
    visibility: hidden;
  }
}

.foo {
  @fragment clearfix;
  margin: 10px;
}
blickwert commented 10 years ago

@peteboere thanks for your quickreply, now it works!