You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just wanna bring up the idea of having peers target just the immediate sibling (.peer + *), not all elements preceded by the peer (.peer ~ *). This will prevent peer-* styles from being accidentally applied for all element that follow the first peer, because in my experience, I only ever used peer to style the immediate next sibling. So if the styles were not applied to the immediate next sibling, they would "expire" and avoid unexpected style in case .peer is used again down the tree.
I understand how it might be useful in many cases to apply the peer style to all elements that follows. And for that, we can use the named peer which are impossible to be match unless the name is specifically mentioned.
so the following classes
Another benefit of this is that we can use the same class and apply it in multiple places without using named peers (which would created other css definitions)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I just wanna bring up the idea of having peers target just the immediate sibling (
.peer + *
), not all elements preceded by the peer (.peer ~ *
). This will preventpeer-*
styles from being accidentally applied for all element that follow the first peer, because in my experience, I only ever used peer to style the immediate next sibling. So if the styles were not applied to the immediate next sibling, they would "expire" and avoid unexpected style in case.peer
is used again down the tree.I understand how it might be useful in many cases to apply the peer style to all elements that follows. And for that, we can use the named peer which are impossible to be match unless the name is specifically mentioned.
so the following classes
would result in the following css
so p2 would not match. If we wanted everything to match we would use
which would result in the following
Another benefit of this is that we can use the same class and apply it in multiple places without using named peers (which would created other css definitions)
Beta Was this translation helpful? Give feedback.
All reactions