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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -