CSS/HTML: Preventing string of non-alphanumeric characters from being split by word wrap? – Education Career Blog

Is there a way to prevent a string of non-alphanumeric characters from being split by word wrapping in HTML/CSS?

For example, in a table cell, if I have a string such as ‘——–‘, it will be split over two lines at the right-hand edge of the cell, whereas ‘aaaaaaaa’ will remain intact and be pushed onto the next line.

Edited to say: the best I’ve come up with so far is to wrap the text in a PRE tag but that creates formatting/layout problems of it’s own.

Thanks,

Neil

,

Use <nobr> or white-space:nowrap.

Leave a Comment