I have a css animated element. You can see the effect in the demo by clicking the checkbox.
In the demo the css is probably put inline so the issue is not shown in the demo. It only shows if the css is loaded from a css file.
Element visible on load (which it should not be)
What happends to me is that the red sidebar becomes visible for a short time before it animates away on load.
How can I get around it?
(I don't want any javascript in this case)
* {
margin: 0;
padding: 0;
}
div {
height: 100%;
width: 100px;
background: red;
position: fixed;
display: block;
margin-left: -100%;
transition: margin 200ms ease-in;
}
input:checked ~ div {
margin-left: 0;
}
}
<input id="hello" type="checkbox">
<div>
adasdsaas
</div>