I'm attempting to create a sliding box effect from left to right using only transitions, similar to this:
#box {
width: 150px;
height: 150px;
background: red;
position:absolute;
transition: all 2s ease-out;
right:auto;
}
.active{
background-color: green !important;
right:0 !important;
}
<div id="box" onclick="this.classList.add('active')"></div>
However, I am encountering an issue where the box does not slide to the right.
The solution provided works, but lacks explanation. Can someone clarify why the background color transitions but not the right position?