0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

# SafariでTailwindの`break-words`を使うとレイアウトがぶっ壊れる問題について 🧭

Posted at

環境

  • Tailwind CSS: v3.4.16
  • ブラウザ: Safari Version 17.5

現象

Safariでは、break-wordsクラスを適用してもbreak-normalと変化がなく、単語が正しく折り返されません。また単語が折り返されず改行が行われないため下記のようにレイアウトがぶっ壊れてしまいます。

messageImage_1740299169016.jpg

調査と考察

Safari特有のレンダリングバグのようで、ウィンドウリサイズ時やクラスのオンオフで一時的に正常な動作が確認されるものの、根本的な問題はWebKit側の不具合らしいです。

下記GithubのIssue
https://github.com/tailwindlabs/tailwindcss/issues/8743

回避策

以下のCSSを適用することで、Safariでも期待通りの挙動を実現できます。
単語ごとに改行せず、normalで改行させるようにしました。

@supports (-webkit-touch-callout: none) {
  .break-words {
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
}

余談

これのせいで位置時間悩みましt

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?