JSFiddle - React, Tailwind, and code Playground
HTML
<div class="outercontainer">
<div class="optioncontainer">
<div class="optionlist">
<li class="listitem" id="red">Red</li>
<li class="" id="blue">Blue</li>
<li class="listitem" id="green">Green</li>
<li class="listitem" id="yellow">Yellow</li>
<li class="listitem" id="orange">Orange</li>
<li id="white">White</li>
<li id="black">Black</li>
</div>
</div>
</div>
CSS
/* Start Miscellaneous stuff */
body {
background: #131418;
color: #999;
text-align: center;
}
.optionlist a {
color: #999;
text-decoration: none;
}
@keyframes mycoolfadeout {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes mycoolfadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* End Miscellaneous stuff */
.outercontainer {
border: 1px solid blue;
/*This needs to be in the middle of the screen and everthing should fit inside it*/
position: fixed;
/*border to highlight only - not part of final product*/
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 1200px;
max-width: 80vw;
height: 600px;
max-height: 70vh;
}
.optioncontainer {
width: 250px;
max-width: 20vw;
}
.optionlist li {
background: #fff;
padding: .5em;
box-shadow: inset 10px 10px 100px 25px rgba(0, 0, 0, .8);
list-style-type: none;
}
.optionlist li:nth-child(odd) {
background: #000;
}
.optionlist li:hover {
background: red;
}
.optionlist li:hover::after {
/* The part the needs to be fixed */
animation: mycoolfadein 1s;
display:block;
}
/* Start Background Control */
.listitem::after {
content: "";
width: 80vw;
height: 70vh;
background-image: url(http://lorempixel.com/800/600/);
background-size: 80vw 70vh;
position: fixed;
top: 50%;
left: 50%;
display:none;
transform: translate(-50%, -50%);
}
/* End Background Control */