an icon right next to it:
How can I get rid of the space marked with X? The blue circle with an "i" in it should be to the immediate right side of the text block.
.wrapper {
/* wrapper has limited space, so that longerText sometimes wraps to 2 or 3 lines */
width: 25rem;
display: flex;
/** image should be centered next to text */
align-items: center;
/* gap between text and image should not grow larger than that */
gap: 0.5rem;
}
.longerText {
background-color: beige;
/* QUESTION: How to position smallImage right next to longerText (gap no larger than 0.5rem)? */
flex: auto 0 1;
}
.smallImage {
/* image shouldn't grow or shrink */
flex: auto 0 0;
background-color: lightskyblue;
text-align: center;
width: 1.5rem;
height: 1.5rem;
border-radius: 50%;
}
<div class="wrapper">
<div class="longerText">
Longer text that uses 1, 2 or 3 lines depending on language and
available space
</div>
<div class="smallImage">i</div>
</div>