2017-10-01 6 views
0

私は次のscssスニペットを持っています。 .childが存在する場合、私は他の場所で/それ子どもがいる間だけSCSSスタイル親

.container { 
    height: 100%; 
    color: red; 
    :global { 
    .child { 
     background-color: black; 
    } 
    .container .child { <=== This obviously doesn't work but 
          I need .container to be yellow only when child is present 
     color: yellow; 
    } 

    } 
} 

.childを持つ要素を削除し追加、削除され、私はSCSSであることを表すにはどうすればよいコードを持っている.containeryellowの色を持っていたいですか?

+2

[CSS親セレクタはありますか?](https://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector)の可能な複製 – Quentin

答えて

関連する問題