Reputation: 21
I have a website where I use the hyphens: auto
function to break longer words. It all works fine, but at some places it breaks words which shouldn't be broken. For example names of team members. How can I still keep the hyphens function, but exclude some words from breaking?
As it only happens on a very few words I could edit every word separately.
Any suggestions?
Thanks!
Upvotes: 2
Views: 944
Reputation: 56
Since there is no code example I am assuming that I understood it correctly.
I think putting these words into a span which you style accordingly should do the trick.
<div>
<p>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
very long paragraph which doesn't end Edgar <span>TestingnamesonIdont'tknowwhatcanmakethispossiblyanylongerthanthiswhichIamdoingrightnow.</span>
</p>
</div>
p{
overflow-wrap: break-word;
word-wrap: break-word;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
p span{
overflow-wrap: normal;
word-wrap: normal;
-ms-hyphens: none;
-moz-hyphens: none;
-webkit-hyphens: none;
hyphens: none;
}
Hope this helped!
Upvotes: 2