为什么要用转义字符串?
HTML中,&等有特殊含义(,用于链接签,&用于转义),不能直接使用。这些符号是不显示在我们最终看到的网页里的,那如果我们希望在网页中显示这些符号,该怎么办呢?
这就要说到HTML转义字符串(Escape Sequence)了。
转义字符串(Escape Sequence)也称字符实体(Character Entity)。在HTML中,定义转义字符串的原因有两个:第一个原因是像“”这类符号已经用来表示HTML标签,因此就不能直接当作文本中的符号来使用。为了在HTML文档中使用这些符号,就需要定义它的转义字符串。当解释程序遇到这类字符串时就把它解释为真实的字符。在输入转义字符串时,要严格遵守字母大小写的规则。第二个原因是,有些字符在ASCII字符集中没有定义,因此需要使用转义字符串来表示。
转义字符串(Escape Sequence),即字符实体(Character Entity)分成三部分:
第一部分是一个&符号,英文叫ampersand;
第二部分是实体(Entity)名字或者是#加上实体(Entity)编号;
第三部分是一个分号。
比如,要显示小于号(
" | " | " |
& | & | & |
< | < | |
> | > | > |
不断开空格(non-breaking space) |
? | ¡ | ¡ | Á | Á | Á | á | á | á |
¢ | ¢ | ¢ | Â | Â | ˆ | â | â | â |
£ | £ | £ | Ã | Ã | Ã | ã | ã | ã |
¤ | ¤ | ¤ | Ä | Ä | Ä | ä | ä | ä |
¥ | ¥ | ¥ | Å | Å | ˚ | å | å | å |
| | ¦ æ ; | æ | § | § | § | Ç | Ç | |
ç | ç | ç | ¨ | ¨ | ¨ | È | È | |
è | è | è | © | © | © | É | É | |
é | é | é | a | ª | ª | Ê | Ê | |
ê | ê | ê | ? | « | « | Ë | Ë | |
ë | ë | ë | ? | ¬ | ¬ | Ì | Ì | |
ì | ì | ì | /x7f | | | Í | Í | |
í | í | í | ® | ® î | ® | î | ||
ˉ | ¯ | ¯ | Ï | Ï | Ï | ï | ï | ï |
° | ° | ° | Ð | Ð | Ð | ð | ð | &ieth; |
± | ± | ± ñ ; | 2 | ² | ² | Ò | Ò | |
ò | ò | ò | 3 | ³ | ³ | Ó | Ó | |
ó | ó | ó | ′ | ´ | ´ | Ô | Ô | |
ô | ô | ô | μ | µ | µ | Õ | Õ | |
õ | õ | õ | ||||||
? | ¶ | ¶ | Ö | Ö | Ö | ö | ö | ö |
· | · | · | × | × | × | ÷ | ÷ | ÷ |
? | ¸ | ¸ | Ø | Ø | Ø | ø | ø | ø |
1 | ¹ | ¹ | Ù | Ù | Ù | ù | ù | ù |
o | º | º | Ú | Ú | Ú | ú | ú | ú |
? | » | » | Û | Û | Û | û | û | û |
? | ¼ | ¼ | Ü | Ü | Ü | ü | ü | ü |
? | ½ | ½ | Ý | Ý | Ý | ý | ý | ý |
? | ¾ | ¾ | Þ | Þ | Þ | þ | þ | þ |
? | ¿ | ¿ | ß | ß | ß | ÿ | ÿ | ÿ |
À | À | À | à | à | à |
\b | 退格 |
\f | 走纸换页 |
\n | 换行 |
\r | 回车 |
\t | 横向跳格 (Ctrl-I) |
\' | 单引号 |
\" | 双引号 |
\\ | 反斜杠 |
编程的时候要注意特殊字符的问题,很多运行时出现的问题都是因为特殊字符的出现而引起的。
注意,由于反斜杠本身用作转义符,因此不能直接在脚本中键入一个反斜杠。如果要产生一个反斜杠,必须一起键入两个反斜杠 (\\)。
参考资料:
http://114.xixik.com/character/

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.