我目前有这个:
我想将图标 div 放在文本末尾,但因为它是一个“块”,所以我无法使其工作。
想要的输出:
代码片段:
* { font-family: Arial, 'sans-serif' } .test { display: flex; } .info { font-family: 'monospace'; background: black; width: 18px; height: 18px; aspect-ratio: 1; text-align: center; border-radius: 50%; color: white; }
<div class="test"> Donec rutrum congue leo eget malesuada. Donec sollicitudin molestie malesuada. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <div class="info">i</div> </div>
P粉7386761862024-04-05 20:34:40
display: flex
(.test
).info
)设置为 inline-block
并使用 display: inline-block
* { font-family: Arial, 'sans-serif' } .info { display: inline-block; font-family: 'monospace'; background: black; width: 18px; height: 18px; aspect-ratio: 1; text-align: center; border-radius: 50%; color: white; }
Donec rutrum congue leo eget malesuada. Donec sollicitudin molestie malesuada. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.i