Z
Z
ZMaxonchik2019-05-14 22:00:41
css
ZMaxonchik, 2019-05-14 22:00:41

How to refer to a block within a block in css?

Hello!
What is the correct way to refer to blocks within blocks?
Here is the code in SASS
.block1 {
.block2 {
.block3 {
}
}
}
How to refer to block 3 in CSS? Or will it be enough just to write .block3 {} ​​right away?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Proskurin, 2019-05-14
@ZMaxonchik

Well, if you write
.block3 {}
​​then all elements on the page with class block3 get the styles described in this block. If like this
.block1 .block2 .block 3 {}
then only the block3 elements that are inside the block2 block that is inside the block1 block will apply styles to themselves.

I
iBird Rose, 2019-05-15
@iiiBird

and to take and see the compiled css of your scss yourself is not destiny?
skrinshoter.ru/v/140519/ixSskVbO?a
https://codepen.io/anon/pen/arpvjQ

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question