0

Handling Long Icon Label Texts Without Affecting Layout: CSS Solutions Needed

I’m facing an issue where icons move out of their intended position whenever the label text is too long, which I suspect is due to fixed spacing and layout in my CSS. How can I adjust my CSS to accommodate longer text without disrupting the layout? Are there specific properties or techniques I should consider to prevent this issue and maintain a neat and organized appearance for the icons and their labels?

17th Mar 2024, 1:19 AM
Lerigeo Xingpaa
Lerigeo Xingpaa - avatar
5 Answers
+ 2
Flexbox and Grid layouts are good to know when working with layout. Also the Text overflow property could help.
20th Mar 2024, 4:26 PM
Chris Coder
Chris Coder - avatar
+ 1
can you give a simplified example of your code? my blind guess is something along word-break and word-wrap..
17th Mar 2024, 2:54 AM
Bob_Li
Bob_Li - avatar
+ 1
the tag i makes text italic. it is a misuse of i if you want to display icons. maybe just use <span>? From your example, the icons and lbl are being displayed in separate lines because you specified .lbl to use display:block. if you want it to be on the same line as the icon, maybe you should use display:inline-block.
17th Mar 2024, 3:43 AM
Bob_Li
Bob_Li - avatar
0
You can see: Please note, our class name is just an example, for shortcut purposes. <div class="text-center"> <i class="i1 i"></i> <span class="lbl">i1lbl</span> </div> <div class="text-center"> <i class="i2 i"></i> <span class="lbl">i2lbl</span> </div> .i { font-size: 28px; color: red; } .lbl { display: block; color: black; font-size: 12px; margin-top: 18px; }
17th Mar 2024, 3:10 AM
Lerigeo Xingpaa
Lerigeo Xingpaa - avatar
0
Each individual contributes something and together we make the world better. I am happy with your response.
24th Mar 2024, 11:18 AM
Lerigeo Xingpaa
Lerigeo Xingpaa - avatar