Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split Text in <DIV>

Tags:

html

css

I have a very long text without space. For example,

<div style="width: 179px">
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
</div>

I want to split this text into lines with maximum width 179px. Do you know how to do that?

like image 368
Rasika H Avatar asked Sep 22 '11 16:09

Rasika H


People also ask

How to split text into two parts in HTML?

Create an HTML div element with the class “container”. Inside the “container”, create an HTML div with class “box”. Create two p tags with text. To split the text we are going to provide the text shape using clip-path and then use transform property on hover to translate it.

How do I split text into two columns?

Select the data you want to split. Go to the Data tab and select the Text to Columns icon from the Data Tools Then select the Next button. Now you need to choose where you want the split text. Click on the Destination field, then select the destination cell on the worksheet in the background where you want the split text to start.

How to create a text split effect using CSS?

In this article, we will see how we can create a text split effect using CSS. HTML code is used to create the basic structure of the sections and CSS code is used to set the style. Create an HTML div element with the class “container”. Inside the “container”, create an HTML div with class “box”.

How do I revert a split text?

Each SplitText objects stores arrays of all the split elements. For instance mySplitText.words would return an array of all the divs that wrap each word. SplitText can be reverted to its pre-split state using the revert () method. Animating text that has been split is dead simple using GSAP.


1 Answers

Use CSS.

word-wrap: break-word;
like image 176
duri Avatar answered Sep 28 '22 06:09

duri