Search code examples
androidhtmlcssiphoneline-breaks

Line Break on small devices - IPhone / Android


my problem is the line break (automatically) on an iPhone.

Example Code:

<span>example text</span>

this span is boxed with multiple divs and some other stuff, that it have to break into two lines on an iPhone 4. But it doesn't automatically.

So i tried to use this combined and single

word-break: break-all;
word-wrap: break-word;

It works on an iPhone but on any other device it destroys the normal line-break.

the expected result should be

example
text

the happened result

example te
xt

What should i do to get my expected result on any mobile device?

Thanks for reading, I'm sorry for my bad English.

Kind regards


Solution

  • word-break: break-all; and word-wrap: break-word; does the exact opposite of what you want. These css properties will allow words to be broken in the middle of a word. The reason why it doesn't break is because you're using the <span> tag, which is supposed to only take up one line. Consider using a <div> or <p> tag instead.