caniemail icon indicating copy to clipboard operation
caniemail copied to clipboard

overflow-wrap is supported in Apple Mail

Open jensimmons opened this issue 1 year ago • 6 comments

Can I Email says Apple Mail doesn't support overflow-wrap, but both Can I Use and MDN say it is supported.

  • https://www.caniemail.com/features/css-overflow-wrap/
  • https://caniuse.com/wordwrap
  • https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap#browser_compatibility

jensimmons avatar Jan 30 '24 01:01 jensimmons

I'm seeing the same results in Apple Mail as in Safari.

Screenshot 2024-01-29 at 9 06 45 PM

jensimmons avatar Jan 30 '24 02:01 jensimmons

@jensimmons I just sent that same test to myself and it's still not rendering correctly for me. I'm curious, though, how you injected HTML into a Mail compose window? The only way I know of is dragging an email draft to the desktop, updating the HTML in a text editor, and then importing the .eml back into Mail. Is there a better way?!

Screenshot 2024-01-31 at 10 03 32

michael-westphal avatar Jan 31 '24 15:01 michael-westphal

I highlighted the content of the test in a web browser window, copied it, and pasted it into a draft email.

jensimmons avatar Jan 31 '24 15:01 jensimmons

That never seems to work for me. No matter which paste option I use, I always get the content without any styling. Not sure what's going on there.

Interestingly, when I inject the overflow-wrap test into a mail compose window using my export/import process, I get the same result you do:

Screenshot 2024-01-31 at 10 31 25

Once I send it to myself, though, it renders incorrectly in the inbox.

michael-westphal avatar Jan 31 '24 15:01 michael-westphal

Interesting. I saw the same thing once the email was sent. Thanks.

jensimmons avatar Jan 31 '24 16:01 jensimmons

It looks like Apple Mail default CSS styles include word-break: break-word; which affects this. It doesn't mean the overflow-wrap property isn't supported though.

Apple Mail ssems to support word-break. Here are some screenshots using the same test code but adding word-break: normal to reset Apple Mail's default CSS:

https://testi.at/proj/xlelivydsj4o09lz

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    p {
      width: 150px;
      background-color: tomato;
      margin: 20px;
    }
  </style>
</head>
<body>

  <p>This is a very long word: <span style="word-break:normal; overflow-wrap: normal;">Pneumonoultramicroscopicsilicovolcanoconiosis</span> The word is 45 letters. <em>no wrap</em></p>
  <p>This is a very long word: <span style="word-break:normal; overflow-wrap:normal;">Pneumonoultramicroscopicsilicovolcanoconiosis</span> The word is 45 letters. <em>overflow-wrap: normal</em></p>
  <p>This is a very long word: <span style="word-break:normal; overflow-wrap:break-word;">Pneumonoultramicroscopicsilicovolcanoconiosis</span> The word is 45 letters. <em>overflow-wrap: break-word</em></p>
  <p>This is a very long word: <span style="word-break:normal; overflow-wrap:anywhere;">Pneumonoultramicroscopicsilicovolcanoconiosis</span> The word is 45 letters. <em>overflow-wrap: anywhere</em></p>
  
</body>
</html>

husseinalhammad avatar Jan 31 '24 18:01 husseinalhammad