This is now the second project I have worked on where I am unable to get the image that is hidden on load to display: block on :active. I have also tried to used visibility with no luck. I prefer the display so the height is not left empty.
a {
text-decoration: none;
}
.button-container {
margin-left: auto;
margin-right: auto;
max-width: 200px;
}
.img {
display: none;
}
.buy-button {
background-color: #087900;
border-radius: 25px;
color: #ffffff;
text-align: center;
}
h2 {
padding: 12px 40px;
font-size: 18px;
font-family: Open Sans;
font-weight: normal;
}
.img:active {
display: block;
}
.buy-button:active {
height: 10px;
margin-top: 50px;
margin-left: 0;
margin-right: auto;
width: auto;
}
h2:active {
display: none;
}
<div class="img"><img src="https://sf-static.sixflags.com/wp-content/uploads/icon-coaster-car-person.png"></div>
<div class="button-container">
<div class="buy-button">
<h2>Buy Now</h2>
</div>
</div>