-2

I want that a text inside a div will continue in a new line when reaching the border of the div, and not overflow.

I tried using "word-break" and all kind of overflow properties, yet I didn't succeed to solve my problem.

<div class="col-lg-3">
     <div>  
          <h2>
               <a >
                     Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
               </a>
          </h2>
     </div>
</div>

I want that the text inside the tags will continue in new line and not overflow.

Thanks

Michiel
  • 4,160
  • 3
  • 30
  • 42
CrazyPhrog
  • 57
  • 9
  • What about using `
    `?
    – Prince Vegeta Jul 25 '19 at 06:47
  • the text will be dynamic, I don't know its length – CrazyPhrog Jul 25 '19 at 06:48
  • 2
    Standard behaviour is that text continues on a new line when it reaches the end. If it doesn't do that then it has to be explicitly set somewhere. We don't know your CSS so we can't say where – cloned Jul 25 '19 at 06:48
  • Possible duplicate of [

    when text exceeds width, continue in new line](https://stackoverflow.com/questions/13790170/p-when-text-exceeds-width-continue-in-new-line)

    – Roma Jul 25 '19 at 07:08

2 Answers2

1

You can use overflow-wrap: break-word; or word-wrap: break-word; to do this.

Demo:

h2 {
  overflow-wrap: break-word;
}
<div>  
          <h2>
               <a >
                 long text that overflow ....................................................................................................................................................................................................................................................................................................
               </a>
          </h2>
   </div>
Cuong Le Ngoc
  • 11,595
  • 2
  • 17
  • 39
-1

use thisoverflow-wrap: break-word

<div class="col-lg-3">
    <div>  
          <h2 style="overflow-wrap: break-word">
               <a >
                 long text that overflow long ........... ............................................................................................................................
               </a>
          </h2>
   </div>
</div>


Selva Supriya VS
  • 370
  • 1
  • 4
  • 11