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?

More than 3 years have passed since last update.

改行が含まれる文字列をそのまま表示する方法

Posted at

困ったこと

改行が含まれている文章がそのまま表示されない。。(改行が空白になる。)

<div>
  {{content)}}
</div>
今日はピクニック。 楽しいな

スタイルを当てよう

test.html
<div class="content">
  {{content)}}
</div>
test.css
.content {
  white-space: pre-wrap; // 要素内のホワイトスペースをどのように扱うか。今回は変更させない。
  word-wrap: break-word; // 日本語の単語をどう扱うか。今回は改行させる。
}
今日はピクニック。
楽しいな

できた

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?