Stop Word Wrap for t-shirts

Hi All

I am making a website for t-shirts and need to force the code to not split the word t-shirts on word wrap… currently on some devices t- is on one line and then shirts is on the next.

Any idea how I can fix this?

mrmbarnes

Why have you posted in the PHP category? Normally, one would consider that a CSS issue. Are you creating the HTML code with PHP? (Sorry, just being curious…it’s my nature. cat-sm )

I am familiar with a couple of HTML and CSS solutions and aware of at least one more that is not quite ready for prime time.

First, if you can wrap the hyphenated words in span tags, this will work:
CSS:

.nobreak {
    white-space:nowrap;
}

HTML

<p>This paragraph will wrap normally, except for the part about <span class="nobreak">happily-hyphenated-hillbillies</span></p> 

Lastly, if you only have control over the HTML you can use a non-breaking hyphen, &​#8209;. It works but the appearance may differ between font-families and browsers. The caveat of course is that it must be edited out to change it down the road.

1 Like

Moved to HTML/CSS. :slight_smile:

1 Like

Thanks and yes… all my code is in PHP

Do either of the above suggestions resolve your issue, or should we move this post back to the PHP category?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.