scss 在scss中使用非选择器定位除主页之外的所有页面

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss 在scss中使用非选择器定位除主页之外的所有页面相关的知识,希望对你有一定的参考价值。

/*
  http://www.reddit.com/r/Wordpress/comments/2moqec/great_use_case_for_css_not_selector_when/
  
  So I'm working on a client site just now and I was trying to think of the age old problem of how to do the page layout
  (content | sidebar) without applying that same layout to the homepage. If your home page is set to a static page, you 
  can't use body.page{} because the home page is still technically a page. 
  
  You could overwrite all the styles for body.page.home{} but then you're repeating yourself. Then it hit me, use the 
  CSS :not pseudo selector!

  So in my .SCSS file, I had something like this...
*/

body.page:not(.home){
    #primary {
        width: 70%;
        float: left;
    }
    #secondary {
        width: 30%;
        float: left;
    }
}

以上是关于scss 在scss中使用非选择器定位除主页之外的所有页面的主要内容,如果未能解决你的问题,请参考以下文章