My rows consist of two sides: the right side with text and the left side with buttons, separated by justify-content: space-between;
However, for the last row, I want to add a textarea that starts from the right-most side of the buttons.
Is there a way to achieve this? Currently, the textarea starts from the left side of the buttons in the code snippet below. I'm looking for a solution where it starts from the rightmost button instead.
I've been struggling to find a solution due to the dynamic nature of the space the buttons occupy, which affects their positioning on the right side?
.container {
display: flex;
flex-direction: column;
}
.row {
display: flex;
justify-content: space-between;
}
.text {
align-self: center;
}
.buttons {
display: flex;
text-align: right;
}
.button {
border-radius: 10px;
padding: 10px;
margin-left: 10px;
height: 20px;
width: 50px;
}
.button.row_one {
background: purple;
border: 1px solid black;
}
.button.row_two {
background: red;
border: 1px solid black;
}
textarea {
resize: none;
border-radius: 10px;
padding: 10px;
margin-left: 10px;
height: 20px;
}
<div class="container" dir="rtl">
<div class="row">
<div class="text">
<p>Row 1</p>
</div>
<div class="buttons">
<div class="button row_one"></div>
<div class="button row_one"></div>
<div class="button row_one"></div>
<div class="button row_one"></div>
<div class="button row_one"></div>
</div>
</div>
<div class="row">
<div class="text">
<p>Row 2</p>
</div>
<div class="buttons">
<div class="button row_two"></div>
<div class="button row_two"></div>
<div class="button row_two"></div>
<div class="button row_two"></div>
<div class="button row_two"></div>
</div>
</div>
<div class="row">
<div class="text">
<p>Row 3</p>
</div>
<div class="textarea">
<textarea>Hello</textarea>
</div>
</div>
</div>