Is there a way to mimic an 'unclick' event with CSS only? I was able to mimic a 'click' via transition property with time delay value. The action stays put for a long time as if the button has been clicked. How do I make this element 'unclicked', or retract it back to its original state? For instance, is there a way to click elsewhere on the screen and have the .sidebar (see the included code) be 'unclicked'?
.sidebar > p {
background: blue;
width: 15em;
-webkit-transition: all 0s 1000s;
transition: all 0s 1000s;
position: relative;
}
.sidebar:active > p {
background: blue;
transform: translate(60px, -40px);
width: 40em;
transition: all 0s;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class='wrapper'>
<div class='sidebar'> Sidebar
<p>This is paragraph 1 inside sidebar </p>
<p>This is paragraph 2 inside sidebar </p>
</div>
<div class='other'></div>
</div>
</body>
</html>
Thank you very much for your input.
FYI
This is not a homework project.
I'm aware of JavaScript. This exercise is for learning CSS.
I'm aware of other possible ways to mimic a click, like described here Can I have an onclick effect in CSS? or better yet here https://tympanus.net/codrops/2012/12/17/css-click-events/