Skip to Content
Menu

clearfix()

A shortcut for fixing floats.

Sass February 22, 2017

Usage

Sass
clearfix()

Parameters

This function does not accept any parameters. Is this incorrect?

Examples

Sass
.element {@include clearfix();}
Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /assets/scss/partials/_mixins.scss on line 241.

    Sass
    @mixin clearfix(){
        &::before,
        &::after {content: ""; display: table;}
        &::after {clear: both;}
    }
    

    Override

    To override or disable this, redefine the mixin/function later on, or use different class names to prevent this from targeting your element.

    Sass
    @mixin clearfix(){
        //Write your own code here, leave it blank, or return false.
    }