Obsivus Obsivus - 7 months ago 6
HTML Question

automaticly breaking a word in correct way?

I am using bootstrap.
Let say I have text that looks like this:


"Stackoverflow"


Can I somehow automaticly make sure that it breaks like this if the text does not fit the container:


"Stack

-overflow"


instead of:


"Stackov

-erflow"


with html/css?

Any tips or hints is appreciated.

Answer

You can use <wbr> tag

p {
  width: 60px;  
  border: 1px solid black;
}
<p>Stack<wbr>overflow</p>