Sam Murray-Sutton
Sam Murray-Sutton

Reputation: 1459

How to chain pseudo selectors in SASS

I'm trying to put together a selector in SASS that will operate on the visted, hovered state of a link, but I can't quite seem to get the markup right, can someone enlighten me? I was writing it like this:

 &:visited:hover
     attribute: foo

Upvotes: 8

Views: 14148

Answers (3)

Sebastian
Sebastian

Reputation: 929

Perfect for Hover and Before / After:

&:hover {
    color:#FFFFFF;

    &::before {
      color:#FFFFFF;
    }
}

Upvotes: 0

crispy
crispy

Reputation: 5877

a
  &:visited:hover
    attribute: foo

Nowadays, this is the only valid form. Indention has to be consistent (2 spaces are recommended) and the colon follows the attribute.

Upvotes: 10

user6325
user6325

Reputation: 264

a
 &:visited:hover
    :attribute foo

Try that - note that identation is two spaces, and the colon goes before attribute not after.

Upvotes: 1

Related Questions