T
T
tytkawa2014-12-03 15:30:15
Sass
tytkawa, 2014-12-03 15:30:15

How to get rid of nesting in SCSS?

Here is the code:

.present {
    background: red;

    .present__slider {
        height: 310px;
        overflow: hidden;

        .present__list {

            .present__item {
                float: left;
                width: 25%;
                text-align: center;
                background: url(../picture/present__list.png)50% 0 no-repeat;
                padding: 0 15px;
                margin: 0 -15px;

                p {
                    color: #97dfff;
                    font-size: 13px;
                    margin: 12px;

                }
            }
        }
    }
}

When compiled, it outputs:
.present {
  background: red; }
  .present .present__slider {
    height: 310px;
    overflow: hidden; }
    .present .present__slider .present__list .present__item {
      float: left;
      width: 25%;
      text-align: center;
      background: url(../picture/present__list.png) 50% 0 no-repeat;
      padding: 0 15px;
      margin: 0 -15px; }
      .present .present__slider .present__list .present__item p {
        color: #97dfff;
        font-size: 13px;
        margin: 12px; }

But I want to get without attachments, like this:
.present {
  background: red; }
  .present__slider {
    height: 310px;
    overflow: hidden; }
    .present__item {
      float: left;
      width: 25%;
      text-align: center;
      background: url(../picture/present__list.png) 50% 0 no-repeat;
      padding: 0 15px;
      margin: 0 -15px; }
      .present__item p {
        color: #97dfff;
        font-size: 13px;
        margin: 12px; }

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