CSS: How do I place an icon next to text?
P粉668146636
2023-08-17 14:39:36
<p>I have a parent div element (display: flex) like this, containing two child elements</p>
<ol>
<li>Text - a span element</li>
<li>(i) icon - a div element</li>
</ol>
<p>When the text is only one line (no line breaks), everything works fine.
However, when it wraps (2 lines or more), the element's width will adjust based on the widest line</p>
<p>I want the text to wrap when it is longer. </p>
<p>In the example above, I want the (i) icon to be next to NORTH. </p>
<p>I want the (i) icon to be next to NORTH. </p>
If you just want the icon to always be next to the word "North", just put it inside a tag: