I have below html and css to display some data as per screenshot. If I add white-space: nowrap; Then text moves out of the box (the first screenshot). If I don't use then it wraps but disturbs the box alignment(2nd row in screenshot).
Any property I can set to fix this without increasing box width? I have tried display property as well but no luck so far.
<html> <head> <meta charset="UTF-8"/> <style> .sideBarList li { width: 12%; height: 50px; text-align: center; line-height: -10px; border-radius: 10px; background: skyblue; margin: 0 10px; white-space: nowrap; display: inline-block; color: black; position: relative; text-align: center; font-family: Arial; font-size: 11px; } .sideBarList li::before{ content: ''; position: absolute; top: 25px; left: -8em; width: 8em; height: .2em; background: skyblue; z-index: -1; } </style> </head> <body> <ul class="sideBarList"> <li class="li">Hi There</li> <li class="li">Hi There</li> <li class="li"> ABC DEF GHI TYTYT YTYYT IIIOO</li> </ul> </body> </html>