Jss: Adjacent sibling selector

Created on 1 Feb 2017  路  5Comments  路  Source: cssinjs/jss

I could not find any examples on how to use the adjacent sibling selector, e.g .room-<id> + .room-<id>.

I've tried using the following without any luck:

const styles = {
    room: {
        display: "flex",
        padding: [25, 20],
        "$room + $room": {
            borderTop: [1, 'solid', '#eee'],
        }
    }
}

But great library! :-)

question

Most helpful comment

If you are already using jss-nested which is part of default preset, you can simply do & + &, like in sass, & is replaced by the parent class.

All 5 comments

You want to target current rule?

If you are already using jss-nested which is part of default preset, you can simply do & + &, like in sass, & is replaced by the parent class.

Ah heck, yes - it did not work since each element was wrapped in another div.

So its what you need? Otherwise I don't know what you are trying to achieve.

The output is correct & + &. So no issues. Closing is fine

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Telokis picture Telokis  路  3Comments

antoinerousseau picture antoinerousseau  路  3Comments

brianmhunt picture brianmhunt  路  5Comments

AleshaOleg picture AleshaOleg  路  3Comments

EugeneSnihovsky picture EugeneSnihovsky  路  4Comments