A
A
Aslan2016-06-24 11:58:10
css
Aslan, 2016-06-24 11:58:10

Is it correct to write sass in this way?

Is it worth the cost of the cascade in this way? When compiling sass compiles into 1 style.min.css file

.callback{
  padding: 20px 0;
  &__header{
    font-size: em(22);
    line-height: 30px;
    font-weight: 600;
    text-align: center;
  }
  &__subheader{
    font-size: 18px;
    font-weight: 400;
    line-height: 40px;
    color: $grey_color;
    text-align: center;
    
  }
  &-form{
    float: none;
    margin: 0 auto;
    &__name{
      width: 100%;
    }
  }
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey delphinpro, 2016-06-24
@iFlashka

Yes. Almost.
You have two blocks here (BEM blocks)

.callback {}
.callback-form{}

It's better to write them separately. And the elements are quite normal.

Z
zooks, 2016-06-24
@zooks

Yes that's right.

M
metaf, 2016-06-24
@metaf

In the future, things like &__header will turn into HELL if your project grows into dozens of separate .scss and there will be no sourcemap. Because it will be unrealistic to find the desired element .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question