I am trying to get a div
element to transition when an a
element is clicked using pure CSS. Here is my code so far:
HTML:
<div id="red"></div>
<a href="#" id="click">Click me</a>
CSS:
div#red {width: 100px;
height: 100px;
background-color: red;
transition: 2s ease;}
a#click:active~ #red {width: 300px;}
I have a feeling what I am trying to do is not possible. Does the transition have to occur on the same element that was clicked?