In CSS, does this make sense or is it legal to embed an identifier in another identifier - for example, #main #display img {...} "

In CSS, if it

#main #display img { height: 80px }

means that all images inside an element with id displayare inside another element with id main. But does this make sense or is it legal, since the identifier is just global names.

This is because SASS actually allows nesting, and some code can nest it as

#main
  width: 700px

  #display
    img
      height: 80px

which is the "id inside id".

Update: because, presumably, there should never be

#main #display img { height: 80px }
#sidebar #display img { height: 80px }

that is, there should never be two elements with id display. So usually instead of writing

#main #display img { height: 80px }

you can also write

#display img { height: 80px }
+3
2

- , , ( "if #display #main, , " ).

, .

+7

. , , .

. CSS , .

0

Source: https://habr.com/ru/post/1749690/


All Articles