2013-05-30 3 views
1

Modernizr 클래스를 사용하고 싶지만 현재 중첩 선택기에서 SASS로 올바르게 수행하는 방법을 볼 수 없습니다. 현재 SASS 중첩에 조상 선택기를 추가하십시오.

최적화하는 방법 :

.page-home .content .rows .row { 
    background: blue; } 
    html.no-touch .page-home .content .rows .row:hover { 
    background: red; } 
.page-home .content .images { 
    width: auto; } 
    html.touch .page-home .content .images { 
    max-width: 50px; }   

이를 참조하십시오

.page-home .content .rows .row { 
    background: blue; 
} 
html.no-touch .page-home .content .rows .row:hover { 
    background: blue; 
} 
.page-home .content .images { 
    width: auto; 
} 
html.touch .page-home .content .images { 
    max-width: 50px; 
}   

답변

3
.page-home 
    .content 
     .rows 
      .row 
       background: blue 

       html.no-touch &:hover 
        background: red 

     .images 
      width: auto 

      html.touch & 
       max-width: 50px 

렌더링됩니다

.page-home 
    .content 
     .rows 
      .row 
       background: blue 

     .images 
      width: auto 

html.no-touch 
    .page-home 
     .content 
      .rows 
       .row 
        &:hover 
         background: red 

html.touch 
    .page-home 
     .content 
      .images 
       max-width: 50px 

같은 것을 렌더링하려면 10 및 this post을 참조하십시오.

+0

SCSS에서 수행 할 수 있습니까? – bazzlebrush