LoginSignup
2
4

More than 5 years have passed since last update.

長い単語を要素内で改行したいときのCSS

Posted at

Divなどの要素内では、1つの単語の長さ > 要素の幅 になると、
単語が要素からはみ出してしまいます。
下記のようなCSSを指定することで、単語の途中でも強制的に、
要素の幅に合わせて改行することが出来ます。

<div>abcdefghijklmnopqrstuvwxyz</div>
div{
    width:50px; /*※必ず幅を指定してください*/
    word-wrap:break-word;
}
2
4
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
2
4