문제

I have a CSS like this:

.button-navigation-container button {
   /*some properties*/
}

        .button-navigation-container button.back-button,
        .button-navigation-container button.cancel-button {
            text-align: right;
            padding-right: 2%;
        }

But now I want to convert to LESS but I'm not sure which kind of selector should I use to get the back-button and cancel-button with the same style. Something like this:

.button-navigation-container button {
       /*some properties*/

            /*Selector for cancel-button and back-button ?*/{
                text-align: right;
                padding-right: 2%;
            }
}

Should I use extend()?

도움이 되었습니까?

해결책

Less

.button-navigation-container {
    button {
        /*some properties for button*/
        &.back-button, &.cancel-button {
            text-align: right;
            padding-right: 2%;
        }
    }
}

StyleSheet (Generated from the LESS)

.button-navigation-container button {
  /*some properties for button*/

}
.button-navigation-container button.back-button,
.button-navigation-container button.cancel-button {
  text-align: right;
  padding-right: 2%;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top