Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent words from breaking/wrapping mid-word in iOS email client

I am building markup for an HTML email, however I can't seem to find a solution to prevent a word from breaking mid-word like this in iOS email client:

enter image description here

HTML:

<table class="row">
    <tbody>
    <tr class="mail-title">
        <td class="wrapper last">
            <table class="twelve columns">
                <tr>
                    <td>
                        <h1 class="center">YOUR ORDER 101 HAS BEEN DISPATCHED</h1>
                    </td>
                    <td class="expander"></td>
                </tr>
            </table>
        </td>
    </tr>
    </tbody>
</table>

CSS:

.mail-title h1 {
    font-size      : 18px;
    text-transform : uppercase;
    font-weight    : normal;
    word-wrap      : none;
    word-break     : break-all;
}

I am using the Zurb Ink email framework, which is what the wrapper, last and expander classes are for.

I'#ve had a look at this answer, which makes sense as Ink defaults to break-word, but this doesn't work on iOS mail.

like image 460
crmpicco Avatar asked Oct 08 '15 09:10

crmpicco


2 Answers

Add the following into your custom styles section of your template to override Ink's styling.

td {
  word-break: break-word;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  hyphens: none;
  border-collapse: collapse !important;
}
like image 172
coryski Avatar answered Oct 04 '22 18:10

coryski


This answer is specific to those implementing email templates with Zurb Ink. So, it appears this is default Ink styling. See here: https://github.com/zurb/ink/blob/master/css/ink.css#L71

I changed the declaration of td to be as below:

td {
    word-break      : normal;
    border-collapse : collapse !important;
}

Fixed.

like image 23
crmpicco Avatar answered Oct 04 '22 19:10

crmpicco