Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make text inside a div multiline? [duplicate]

Tags:

css

Possible Duplicate:
wrapping the text inside div - css

Fiddle: http://jsfiddle.net/aTFK2/2/

HTML:

<div id="ChannelDescription">ThisIsAVeryLongTextWithoutAnySpacesLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmed</div>​ 

CSS:

#ChannelDescription {   width:560px;   color:Gray;   white-space:normal;   font-size:14px; }​ 

NOTE: I cannot change the width to any other value. Neither can I use break points. I am looking for a pure CSS2 solution.

like image 228
Ashwin Singh Avatar asked Aug 14 '12 06:08

Ashwin Singh


People also ask

How do I break text into multiple lines in CSS?

We use the word–break property in CSS that is used to specify how a word should be broken or split when reaching the end of a line. The word–wrap property is used to split/break long words and wrap them into the next line.

How do I make text multiline in HTML?

To create a multi-line text input, use the HTML <textarea> tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows.

How do I wrap text in next line in CSS?

FYI: You can use either the 'normal' or 'break-word' value with the word-wrap property. Normal means the text will extend the boundaries of the box. Break-word means the text will wrap to next line. word-break: break-word; worked for me.


1 Answers

word-wrap: break-word; will solve the problem.

like image 151
Noah Wetjen Avatar answered Oct 30 '22 07:10

Noah Wetjen