웹 개발 공부

HTML 공부 (HTML Character Entity)

지금해냥 2023. 4. 7. 14:04

 

❓ HTML Entity란

HTML 엔터티는 &(ampersand) 로 시작하고 ;(semicolon)으로 끝나는 텍스트 조각 (문자열) 입니다.

  • 특수문자나 공백문자를 작성하는데 주로 사용합니다.
  • XSS 공격 방어 용도로도 사용할 수 있습니다.
    • ex) 
<script>alert("경고")</script>
<!-- 
→ &lt;script&gt;alert(&quot;경고&quot;)&lt;/script&gt;
로 변경하면 html에서 자바스크립트로 동장하는 경우를 방어할 수 있음
-->

 

주로 사용하는 목록은 아래와 같습니다.

 

다른 HTML 엔터티 확인 경로:

https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references

 

HTML Standard

HTMLLiving Standard — Last Updated 30 November 2023 ← 13.2 Parsing HTML documents — Table of Contents — 14 The XML syntax → 13.5 Named character references 13.5 Named character references This table lists the character reference names that are su

html.spec.whatwg.org

 

참고 자료 : https://developer.mozilla.org/en-US/docs/Glossary/Entity

 

Entity - MDN Web Docs Glossary: Definitions of Web-related terms | MDN

An HTML entity is a piece of text ("string") that begins with an ampersand (&) and ends with a semicolon (;). HTML entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (li

developer.mozilla.org

LIST