I want to replace the background of my div by the uploaded file. Note that this div is my Upload Button, and that its background changes on :hover and :active. When the file should be uploaded to the background, the :hover and :active attributes should not have effect.
HTML
<form>
<input id="uploader1" type="file" accept="image/*" style="display:none;" required>
<label for="uploader1">
<div class="square" id="myImg1"></div>
</label>
CSS
.square{
position: relative;
width: 50%;
cursor: pointer;
}
.square:before{
padding-top: 95%;
display:block;
content: "";
}
#myImg1 {
background: url('button.jpg') no-repeat center;
background-size: cover;
}
#myImg1:hover {background:url('buttonHover.jpg') no-repeat center;
background-size: cover;
}
#myImg1:active {
background:url('buttonClick.jpg') no-repeat center;
background-size: cover;
}
#uploader1 > input {
display:none;
}