html - Select parent element in stylus -


i'm using css preprocessor stylus , i'm trying select first parent of element.

<li><span class="correct">ja</span></li> <li><span class="incorrect">nee</span></li> <li><span class="incorrect">mss</span></li> 

i want style li element depending on class of span element.

is possible?

no, not possible in css, , in stylus compiled css.

however, emulate in cases, when want change how parent looks: can use element after 1 class, , stretch in onto parent, see demo: http://dabblet.com/gist/7638112

the html you'd need there:

<ul> <li><span class="correct">ja</span><span class="helper"></span></li> <li><span class="incorrect">nee</span><span class="helper"></span></li> <li><span class="incorrect">mss</span><span class="helper"></span></li> </ul> 

and css:

li {     position: relative;     z-index: 1; }  .helper {     position: absolute;     z-index: -1;     top: 0;     left: 0;     right: 0;     bottom: 0; }  .correct + .helper {     background: lime; }  .incorrect + .helper {     background: red; } 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -