html - How do I make sure my text stays on same line when I add a 'space' inside <li> element? -
i find myself browsing sof , have yet post here is. i'm building new website , relative beginner css. struggling basic nav menu , can't quite research how solve problem..
here website , if under 'contact dropdown you'll see first list item on 2 lines when want on 1 see under 'downloads' drop down.
in case wants code
.nav{ width:100%; background-color: #0066b9; font-family: verdana; font-weight: bold; padding-top: 4px; padding-bottom: 4px; max-height: 31px; } .nav ul{ top: 0; width:960px; margin:0 auto; list-style: none; padding-left: 0px; display: inherit; } .nav li{ display: inline; position: relative; background-color: #003e64; padding-top: 4px; padding-bottom: 4px; } .nav ul li a{ color: white; text-decoration: none; padding: 10px; line-height: 21px; } .nav ul li a:hover{ background-color: purple; color: black; padding-top: 4px; padding-bottom: 4px; } .nav ul li ul{ display: none; position: absolute; margin: 0px; background-color: #003e64; width: auto; } .nav ul > li > ul{ position: absolute; left: 0; margin-top: 27px; display: none; padding-top: 10px; overflow: hidden; } .nav ul li:hover > ul{ display: block; padding-left: 6px; } .nav ul > li > ul > li{ position: relative; display: block; width: auto; } .nav ul > li > ul > li a{ padding: 10px; }
apologies in advance if posted incorrectly. not sure it's asking me indent 4 spaces.
try using white-space
css property:
.nav li { ... white-space: nowrap; }
https://developer.mozilla.org/en-us/docs/web/css/white-space
Comments
Post a Comment