Not word breaking after hyphen?

Soldato
Joined
27 Dec 2005
Posts
17,315
Location
Bristol
Is this possible? I've got a hyphenated word in an h1 which is word breaking after the hyphen and looks awful. Only thing I can find online is to use 8208; instead, but that displays as underscore on mobile?
 
Use a non-breaking space  

edit: sorry, misunderstood that. Non-breaking space is not what you need.

You could add a <span> around it and a "white-space: nowrap" style. Or just add that style to the H1 tags.
 
Use a non-breaking space &nbsp;

edit: sorry, misunderstood that. Non-breaking space is not what you need.

You could add a <span> around it and a "white-space: nowrap" style. Or just add that style to the H1 tags.

nowrap forces the h1 out of its container. In this scenario anyway!
 
Do you mean 8209 for Unicode non-breaking hyphen? Not sure why it'd cause problems on 'mobile'.

Yeah that's right. And same, but it looks like this on my mobile (Chrome):

Q5nP0Uk.jpg
 
It's Google Fonts' Raleway. I guess no point in me testing another because that's the font that needs using, so if it doesn't work it doesn't work!
 
Neat. For reference check Mozilla MDN there are other options available such as
Code:
whitespace: pre
which will break on new lines or br tags and afford more control if you want it.
 
Back
Top Bottom