Avatar of duncanb7
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 undefined
Last Comment

8/22/2022 - Mon
Chris Stanyon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dave Baldwin

Chris is right.  '-' is one of the few characters that will allow text wrapping because that is the way it has traditionally been used.

why &#45 is not working ?
I replaced space with &nbsp; that is working if space is inisde to break the line
Chris Stanyon

&#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)
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

Thanks for all of your reply

Reminder or memo: nbsp mean non-breaking space not just space for html entity