css - Is there a way to group selectors? -
this question has answer here:
i'm trying address div
, table
, ul
, dl
, etc. children of selector using less.
i love write this.
.myclass { ... &.otherclass > (div, ul, dl, table) { // define rules... } }
i expect following output.
.myclass.otherclass > div, .myclass.otherclass > ul, .myclass.otherclass > dl, .myclass.otherclass > table { // rules }
but parenthesis seems not supported, compiles is, resulting invalid css of course.
is there syntax or other way have such shortcut in definitions?
your solution:
.myclass { ... &.otherclass { > div, > ul, > dl, > table { // define rules... } } }
as comment, removing >
selector after first selector, produce different result:
this example
div { > span, p, { border:1px solid #333; } }
compiles
div > span, div p, div { border: 1px solid #333; }
while example
div { > span, > p, > { border:1px solid #333; } }
compiles into
div > span, div > p, div > { border: 1px solid #333; }
Comments
Post a Comment