#snackbar {
min-width: 350px; /* Set a default minimum width */
margin-left: -125px; /* Divide value of min-width by 2 */
background-color: #333; /* Black background color */
color: #fff; /* White text color */
text-align: center; /* Centered text */
border-radius: 2px; /* Rounded borders */
padding: 10px; /* Padding */
position: fixed; /* Sit on top of the screen */
z-index: 1; /* Add a z-index if needed */
left: 85%; /* Center the snackbar */
bottom: 85%; /* 30px from the bottom */
}
<div id="snackbar">
Message 1
</div>
<div id="snackbar">
Message 2
</div>
<div id="snackbar">
Message 3
</div>
All of these elements stack into 1 element and it will only display message 3, but I would like them to stack under 1 of another.
My attempted fix was:
#snackbar ~ #snackbar {
margin-top: 10%;
}
And I thought that would maybe stack them under one another but there was no luck.