I have a flex container with the property flex-warp set to wrap. When the elements break into multiple lines they leave extra space in their last position. How do I remove the extra space (marked with red lines in picture below) ?
What I want to achieve here is a paragraph of text with 2 buttons in front of it, and the 2 buttons should respond to the paragraph's width => when there is one line of text, the buttons should be positioned horizontally, else they should be positioned vertically.
.container {
display: flex;
justify-content: space-between;
border: 1px solid blue;
max-width: 500px;
}
.controls {
display: flex;
flex-wrap: wrap;
align-items: center;
border: 1px solid green;
align-content: start;
}
<div class='container'>
<p class='content-text'>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, consectetur.</p>
<div class='controls'>
<button class='edit-btn' title='Edit'>A</button>
<button class='delete-btn' title='Remove'>B</button>
</div>
</div>
` contains sufficient text such that it has to wrap. You're not considering a `
` with a short line caused by a `
– Dai Mar 03 '22 at 11:55`, for example.
` will contain text only (no html).
– houssam Mar 03 '22 at 11:59