Andrew
Andrew

Reputation: 3999

Treat text as inseparable?

I have a paragraph of text and would like to make sure that one phrase of that paragraph is never broken up between lines. How can I do that?

Thanks for the help!

Upvotes: 0

Views: 872

Answers (3)

Gary.S
Gary.S

Reputation: 7121

The easiest way I can think of is to wrap the phrase in a span tag and add the following css.

#myspan
{
    white-space: nowrap; 
}

JSFiddle: http://jsfiddle.net/9kmaK/5/

white-space info: http://www.w3.org/TR/css3-text/#white-space

Upvotes: 1

Naren
Naren

Reputation: 1920

I may be mis-interpreting your question, but if you're looking for way to not line-wrap in HTML, look up the "white-space" property. http://www.w3schools.com/cssref/pr_text_white-space.asp

Upvotes: 0

Lionel
Lionel

Reputation: 428

Assuming this would be for displaying to the end-user, try using a non-breaking white-space: http://en.wikipedia.org/wiki/Non-breaking_space

Upvotes: 2

Related Questions