Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Issue with @extend and clearfix

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #148068
    Corey Megown
    Participant

    Hi everyone,

    I’m working to gain a better understanding of SCSS and I’ve run across an interesting quirk I’m having trouble with. I created the ‘clearfix’ as a placeholder like so:

    %clearfix:after {
      content: '';
      display: table;
      clear: both;
    }
    

    …then tried to @extend it into some random class like this:

    .platypus {
      @extend clearfix;
    }
    

    This didn’t work, and I’m kind of confused as to why not. Thoughts? Thanks!

    #148069
    __
    Participant

    should be

    @extend %clearfix
    
    #148084
    Corey Megown
    Participant

    Ha. Awesome. Derp.

    Not sure how I missed that one, thanks man!

    #148090
    __
    Participant

    :)

    #148952
    Corey Megown
    Participant

    @basement31

    From what I can tell it doesn’t matter if you do it your way or the way I originally posted it – the output seems to be the exact same. Your version does feel more semantic though, so I would suggest that version.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.