1

Howdy,
I love this neat thing found on css-tricks:

a:active {
  position: relative;
  top: 1px;
}

Every link gives a little trigger-response.

However, I want almost all my links to do that, except the ones inside of .children.

Can I create an exception like :not (from jQuery) within CSS?

Thank you for your help!

2 Answers 2

2

You can just add an additional style rule in CSS, no need for JavaScript, like this:

.children a:active {
  position: static;
  top: 0px;
}
Sign up to request clarification or add additional context in comments.

1 Comment

You technically don’t need top: 0px in there, as top doesn’t have any effect on elements with position: static. But this is mere nitpicking.
0

css

.children a:active {
  /* whatever */
}

assuming your use of ".children" is a class

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.