Is there a CSS or Less solution to change the background color of all dynamically added or removed child elements with a gradual increase of opacity?
ul li {
list-style: none;
font-size: 16px;
text-align: center;
font-weight: bold;
margin: 3px 0;
}
ul li:nth-child(1){
background-color: rgba(0,0,255, 0.1);
}
ul li:nth-child(2){
background-color: rgba(0,0,255, 0.2);
}
ul li:nth-child(3){
background-color: rgba(0,0,255, 0.3);
}
ul li:nth-child(4){
background-color: rgba(0,0,255, 0.4);
}
ul li:nth-child(5){
background-color: rgba(0,0,255, 0.5);
}
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
<li>E</li>
</ul>