Lan Mai
Lan Mai

Reputation: 375

Can I combine :last-child with * in css or sass?

Here's my current code:

.loken5 *
   padding-right: 5px
.loken5:last-child
   padding: 0

Is there any way in SASS that I can use just 1 '.loken5' tag? (purpose is for saving space). Thank you :)

Upvotes: 0

Views: 164

Answers (1)

paolobasso
paolobasso

Reputation: 2018

Sass:

.loken5 
   &:last-child 
      padding: 0
   * 
      padding-right: 5px

Scss:

.loken5 {
   &:last-child {
      padding: 0;
   }
   * {
      padding-right: 5px;
   }
}

If you want .loken5 *:last-child:

.loken5 
   * 
      padding-right: 5px
      &:last-child 
          padding: 0

Checkout this article if you want to know more about the & (SASS ampersant)

Upvotes: 2

Related Questions