how do I turn off the broken word in CSS? If the word contains the keyboard hyphenation, not the soft hyphen.
For example: One day talking to my first-year roommate
Use white-space: nowrap
p {
white-space: nowrap;
}
If you want use nowrap on only part of a text, you can simply put that text in a span element and then apply nowrap to it.
Another much simpler way to prevent just your hyphenated string from wrapping is to replace the keyboard hyphen with ‑
. This will render it as a non-breaking hyphen.
Take a look at word-wrap
// Don't force hyphenate
p { word-wrap: normal; }
// Force words to hyphenate
p { word-wrap: break-word; }