Sass / SCSS Mixin for Clearfix - best approach?

前端 未结 4 697
情书的邮戳
情书的邮戳 2020-12-28 22:57

I want to remove the clearfix class from my HTML and include a clearfix mixin in my SCSS (Rails 3.1 application). What is the best approach to this?

4条回答
  •  悲&欢浪女
    2020-12-28 23:12

    // source http://www.alistapart.com/articles/getting-started-with-sass/
    // http://nicolasgallagher.com/micro-clearfix-hack/
    
        @mixin clearfix {
         // For modern browsers
          &:before,
          &:after {
            content:" ";
            display:table;
          }
    
          &:after {
            clear:both;
          }
    
          // For IE 6/7 (trigger hasLayout)
          & {
            *zoom:1;
          }
        }
    

提交回复
热议问题