-2

I have a problem to showing some space free words in a width limited div or span.

The picture of what i have vs what i need

this is the sample code:

.abc {
  width: 200px;
  height: auto;
  min-height: 100px;
  background-color: blue
}


<div class="abc">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</div>

and i want to show look like this:

http://oi64.tinypic.com/2mnqkco.jpg

thanks

Canser Yanbakan
  • 3,780
  • 3
  • 39
  • 65
reza na
  • 3
  • 1
  • sorry i search that and dont get any result. maybe dont search properly. next time i search more. – reza na Mar 26 '19 at 13:32

3 Answers3

1

Use:

word-wrap: break-word

In your box css.

Here's your code with it working:

<style>
    .abc{width: 200px;height: auto;min-height: 100px;background-color: blue; word-wrap: break-word}
</style>
<div class="abc">
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</div>
Oscar Arranz
  • 631
  • 2
  • 9
  • 23
1

this line of CSS should do it for you:

.abc {
  overflow-wrap: break-word;
}

Or, add this after "background-color: blue"

;overflow-wrap: break-word
Elizabeth
  • 499
  • 2
  • 10
0
<div class="abc">
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</div>  


  .abc{
         width:200px;
          word-wrap: break-word;
        }
Flash
  • 924
  • 3
  • 22
  • 44