M
M
Maxim Ivanov2021-03-29 14:07:30
css
Maxim Ivanov, 2021-03-29 14:07:30

How to nest classes correctly or in what cases?

I use sass(scss) and it is clear that I will not nest classes, as in the example...

Code Example

Usually, if I do, it's like in this example...
'This example'

And here I have three questions:
1) Am I doing it right, as in the second example?
2) When do you need to nest classes, under what circumstances or what?
3) Does it make sense to use Pre at all if I don’t use bam and the like in layout?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
oneManDev, 2021-03-29
@YuHr

It is logical that you write states and pseudo-elements to a specific selector. By the same logic, child selectors should also be written in .block. But that's up to you. And investing more than three levels is not worth it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question