I am trying to make a simple nav with next and previous buttons. Previous is at the far left of the container, and next at the far right. I know what you're thinking: this is the ideal time to use justify-content: space-between
. However, when a user is on the first page or the last page, the backend doesn't output the previous and next buttons respectively. This causes the next button to be aligned left on the first page, and that's not what I want.
I thought I could use align-self
on the children. The problem I encounter now is that the first child pushes the second one down and I don't know how to fix this.
Here's a snippet
.container {
display: flex;
}
.container * {
width: 10%;
height: 80px;
}
#d1 {
background: green;
align-self: flex-start;
}
#d2 {
background: red;
align-self: flex-end;
}
<div class="container">
<div id="d1">
div 1
</div>
<div id="d2">
div 2
</div>
</div>