How to reference nested classes with css?

前端 未结 5 1730
故里飘歌
故里飘歌 2021-02-20 02:04

When using css, how can I specify a nested class.

Here is my html code:

5条回答
  •  执念已碎
    2021-02-20 02:45

    You just need to know how css selectors work. Here is brief description about css selectors.

    In your case,

    .box .box-body i{
      width:30px;
    }
    

    space between two selectors defines second element is child of first. In your case, element i is child element of element which has box-body class. and that element is child element of class which has .box class.

提交回复
热议问题