Link to home
Start Free TrialLog in
Avatar of duncanb7

asked on

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

Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Chris is right.  '-' is one of the few characters that will allow text wrapping because that is the way it has traditionally been used.
Avatar of duncanb7


why &#45 is not working ?
I replaced space with &nbsp; that is working if space is inisde to break the line
&#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)
Thanks for all of your reply
Reminder or memo: nbsp mean non-breaking space not just space for html entity