-1

Below is a screenshot of the responsive mobile display of the wrapped text that breaks on a longer word. Is there any way to avoid this break? I would be OK if it simply starting the text below the ad on mobile. I just want to avoid the break in text.

enter image description here

The HTML I currently use in Wordpress is:

    <div style="padding-right:10px; float: left;"><scriptcode></script></div> Text here
hungerstar
  • 21,206
  • 6
  • 50
  • 59
Adidos
  • 31
  • 1
  • 2
  • This question is too broad and very case specific, you should consider learning better html/css fundamentals – Emi Apr 24 '17 at 17:00

3 Answers3

1

I went with this solution from here.

    p {
      overflow-wrap: break-word;
      word-wrap: break-word;
      -webkit-hyphens: auto;
      -ms-hyphens: auto;
      -moz-hyphens: auto;
      hyphens: auto;
    }
Adidos
  • 31
  • 1
  • 2
0

You can add clear: left to that paragraph to go under anything floated which is above/before it.

Johannes
  • 64,305
  • 18
  • 73
  • 130
  • Would this impact things on mobile and desktop? I'm aiming for a solution that leaves things as-is on desktop (wraps fine around ad), while avoiding the break issue on responsive. – Adidos Apr 24 '17 at 17:39
  • I don't think so - this simply prevents that this text floats around floated elements which are earlier in the code. That would typically only apply to floated images inside the text paragraphs. – Johannes Apr 24 '17 at 17:47
0

I think this is a duplicate of How to prevent line breaks in list items using CSS

See this article for more detail: https://www.w3.org/TR/css-text-3/#white-space

Here's what I'd try to play with and see the effects in your browser:

<style>
.wrap_like_normal{
    font-size: 3rem;
}
.nowrap_ad {
    font-size: 3rem;
    white-space: nowrap;
}
</style>
<p class="nowrap_ad">
    This isn't gonna be wrapped at all. This isn't gonna be wrapped at all. This isn't gonna be wrapped at all. This isn't gonna be wrapped at all.
</p >
<p class="wrap_like_normal">
    Wrap this all you want. Wrap this all you want. Wrap this all you want. Wrap this all you want.
</p>
Community
  • 1
  • 1
Dave Thomas
  • 1,367
  • 2
  • 10
  • 17