0
1

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.

【HTML】エスケープ処理を行う方法

Posted at

#プログラミング勉強日記
2021年3月6日

#エスケープとは
 エスケープは、HTMLのコードでは別の意味を持ったり環境に依存する文字(特殊文字)を別の文字列に置き換えること。
 例えば、<>はHTMLのタグで使われているので、文章中に含めると不具合が生じる可能性がある。そこで、&lt;, &gt;に置き替えることで、安全にページを表示できる。

 実際にスペースの扱い方には気を付ける必要がある。

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;お(エスケープ文字)</p>
<p>あ い う え   お(半角スペース)</p>
<p>あ い う え   お(全角スペース)</p>

image.png

#特殊文字一覧

表示 記号
< &lt;
> &gt;
& &amp;
© &copy;
" &quot;
' &#39;
空白文字 &nbsp;

#参考文献
HTMLのエスケープとは?スペースを表示させる方法について解説!
HTMLで特殊文字のエスケープ処理を行う方法【初心者向け】

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?