Forums

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

Home Forums CSS SASS and SCSS

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #202969
    sergeivisotsky
    Participant

    How can I write if operator form form this SASS code to SCSS?

    figure
        margin-bottom: 20px
        position: relative
        opacity: 0
        transform: translateX(20px)
        transition: all 0.3s ease-in-out
        overflow: hidden
        cursor: pointer
    
    &.is-showing
      opacity: 1
      transform: translateX(0px)
    
    img
      display: block
      transform: scale(1)
      transition: all 0.3s ease-in-out
    
    &:hover
      figcaption
        left: 0%
    
    img
        transform: scale(1.1)
    
    #202970
    Paulie_D
    Member

    Erm…what?

    #202971
    Paulie_D
    Member

    This as SASS

    figure
      margin-bottom: 20px
      position: relative
      opacity: 0
      transform: translateX(20px)
      transition: all 0.3s ease-in-out
      overflow: hidden
      cursor: pointer
      &.is-showing
        opacity: 1
        transform: translateX(0px)
      img
        display: block
        transform: scale(1)
        transition: all 0.3s ease-in-out
      &:hover
        figcaption
          left: 0%
        img
          transform: scale(1.1)
    

    compiles to this CSS

    figure {
      margin-bottom: 20px;
      position: relative;
      opacity: 0;
      transform: translateX(20px);
      transition: all 0.3s ease-in-out;
      overflow: hidden;
      cursor: pointer;
    }
    figure.is-showing {
      opacity: 1;
      transform: translateX(0px);
    }
    figure img {
      display: block;
      transform: scale(1);
      transition: all 0.3s ease-in-out;
    }
    figure:hover figcaption {
      left: 0%;
    }
    figure:hover img {
      transform: scale(1.1);
    }
    

    Which is this in SCSS

    figure {
      margin-bottom: 20px;
      position: relative;
      opacity: 0;
      transform: translateX(20px);
      transition: all 0.3s ease-in-out;
      overflow: hidden;
      cursor: pointer;
      &.is-showing {
        opacity: 1;
        transform: translateX(0px);
      }
      img {
        display: block;
        transform: scale(1);
        transition: all 0.3s ease-in-out;
      }
      &:hover {
        figcaption {
          left: 0%;
        }
        img {
          transform: scale(1.1);
        }
      }
    }
    

    Use SASSMeister to test.

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