I
I
i_want_to_know_everything2015-10-14 03:27:02
css
i_want_to_know_everything, 2015-10-14 03:27:02

What does the symbol & before the selector mean?

What does the symbol & before the selector mean?

&.owl-loaded{
    display: block;
  }

  &.owl-loading{
    opacity: 0;
    display: block;
  }

  &.owl-hidden{
    opacity: 0;
  }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nazar Mokrinsky, 2015-10-14
@i_want_to_know_everything

Means that the name of the tag &.
But most likely, this is not CSS, but SCSS, in which the parent selector is designated as such .

G
GoodProject, 2015-10-14
@GoodProject

It's a Sass preprocessor feature with SCSS syntax.
For example, you create a button:

.button {

}

And you need to set properties for this button when hovering over it:
.button {
    &:hover {

    }
}

That is, instead of the & sign , in this case, .button will be substituted after the compilation of this code.
A handy thing, try it, especially since SCSS is not much different from CSS in terms of syntax, now every self-respecting coder should use such a thing. I especially like the nesting, you don’t need to constantly list all the classes in a line, you just created one header class, and you already add the necessary classes inside it, like:
header {
    h1 {
    //свойство:значение;
    //свойство:значение;
    }
    p {
    //свойство:значение;
    //свойство:значение;
    }
}

In CSS it will look like this:
header {
}
header h1 {
}
header p {
}

That is, you have to write header 3 times , it infuriates me personally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question