When the user is directed to the page or the page is refreshed, the football field should be visible, initially . Subsequently, the user would have the option to collapse the field if they didn't want to view it. Currently, the page opens with the field hidden. I'd like to reverse that.
HTML: I tried placing the image within the tag (where it currently sits) in order to make it responsive with the '-' and '+' signs. I also placed it outside of the label tag.
CSS: I tried using max-height along with a visibility: hidden and visibility: visible as well as display: none and display: flex. The combination of these either minimized the image, made it disappear completely or didn't respond along with the '-' or '+'.
This is my current code:
.game-board {
display: block;
font-size: 1.5rem;
text-align: center;
color: #dcdcdc;
}
label::before {
display: flex;
flex-direction: row;
justify-content: flex-end;
content: '-';
margin-right: 20px;
font-size: 24px;
font-weight: bold;
}
input[type="checkbox"] {
display: none;
}
.football {
width: 90%;
}
.game-board input[type="checkbox"]:checked+label::before {
content: '+';
}
.game-board input[type="checkbox"]:checked+label .football {
max-width: 0px;
}
<div class="game-board">
<input id="field" type="checkbox" checked />
<label for="field"><img class="football" src="img/Saints_Football_field.png" alt="Home Field"></label>
</div>