SASS change nested elements class naming style

梦想的初衷 提交于 2019-12-13 06:40:30

问题


I'd like to use SMACSS naming system with SASS. Expect following SASS code:

nav
  ul
    margin: 0
    padding: 0
    list-style: none

as output i'll get

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

but according to the SMACSS methodology class naming should looks like this:

nav-ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

Could you please advice how to change class naming style in SASS to reach this goal?


回答1:


You can write it like this:

nav
  &-ul
    margin: 0
    padding: 0
    list-style: none

result:

nav-ul {
  margin: 0;
  padding: 0;
  list-style: none;
}


来源:https://stackoverflow.com/questions/24383308/sass-change-nested-elements-class-naming-style

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!