L
L
lilwings2020-01-08 20:01:58
Less
lilwings, 2020-01-08 20:01:58

How to make an extension in less like in the example?

Styles to expand from:

.text {
  font-size: 18px;
  line-height: 26px;
  color: @black;

  &_style_1 {
    font-weight: 600;
    font-size: 16px;
    line-height: 20px;
  }

  &_style_2 {
    font-size: 14px;
    line-height: 20px;
    font-weight: normal;
  }

  &_style_3 {
    font-size: 12px;
    line-height: 16px;
    font-weight: normal;
  }

  @media @Media-max-375 {
    font-size: 16px;
    line-height: 24px;
  }
}

How to use extension from modifier with capturing parent's styles? That is, you need to expand from the modifier, and so that the extension from the parent automatically works.
This is how it doesn't work:
&:extend(.text);
&:extend(.text_style_2);

Doesn't want to expand from modifier

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question