tommywang tommywang - 1 year ago 87
CSS Question

How can I prevent line breaks between words and punctuation in CSS or jQuery

I have some text in a paragraph.
My problem is that when punctuation is at the end of a word, it can sometimes be wrapped to the next line.
Like this:

This is the text
, This is a new line

Can I resolve this with CSS or jQuery?

Answer Source

If you don't put a space between the word and the punctuation, and that it is wrapped anyway, you can use the white-space: nowrap; css instruction. Otherwise, if you need a space between the word and the punctuation, like before a ?, use the non-breaking space code. You can have it by typing alt + 0160 on your keyboard if you're using Windows. For more keyboard methods, read this.

I hope it will help.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download