minus sign html enitity is not working

Dear Experts,

I want my one-line paragraph can be scrolled when it is overflow in div tag.
But the string in the paragraph has minus sign of "-" that will
break the one  line into two lines. WHy ?

I want it displayed in one line even minus-sign in the string so  I
tried to replace "-" minus sign by &#45 that is html code. But it is not
working, it still breaks it into two lines.

Now it is displayed as follow if "-" is inside

I want

Please advise and read my simple attached php html code

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
echo "<div style='overflow-x:scroll;overflow-y:scroll;background-color:yellow;width:300px;height:300px;font-size:14px'>";
echo '</div>';

Open in new window

LVL 13
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
Try white-space:

<p style="white-space: nowrap;">aaaaaaa-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
Chris is right.  '-' is one of the few characters that will allow text wrapping because that is the way it has traditionally been used.
duncanb7Author Commented:
why &#45 is not working ?
I replaced space with &nbsp; that is working if space is inisde to break the line
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Chris StanyonWebDevCommented:
&#45; is exactly the same as - so it will have exactly the same behaviour.

The &nbsp; works because that's what it's supposed to do (Non Breaking SPace)
duncanb7Author Commented:
Thanks for all of your reply
duncanb7Author Commented:
Reminder or memo: nbsp mean non-breaking space not just space for html entity
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.