📄 html_entities.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML Entities</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>HTML Character Entities</h1>
<a href="html_formatting.asp"><img border="0" src="../images/btn_previous.gif" alt="Previous" width="100" height="20" /></a>
<a href="html_links.asp"><img border="0" src="../images/btn_next.gif" alt="Next" width="100" height="20" /></a>
<hr />
<p class="intro">Some characters like the < character, have a special meaning in HTML, and therefore
cannot be used in the text.</p>
<p class="intro">To display a less than sign (<) in HTML, we have to use a
character entity.</p>
<hr />
<h2>Character Entities</h2>
<p>Some characters have a special meaning in HTML, like the less than sign (<)
that defines the start of an HTML tag. If we want the browser to actually display
these characters we must insert character entities in the HTML
source.</p>
<p>A character entity has three parts: an ampersand (&), an entity name or a
# and an entity number, and finally a semicolon (;).
</p>
<p>To display a less than sign in an HTML document we must write: <b>&lt;</b>
or <b>&#60;</b>
</p>
<p>The advantage of using a name instead of a number is that a name is easier to remember. The disadvantage is that not all browsers support the
newest entity names, while the support for entity numbers is very
good in almost all browsers.</p>
<p><b>Note</b> that the entities are case sensitive. </p>
<p>This example lets you experiment with character entities:
<a target="_blank" href="tryit.asp@filename=tryhtml_entities">Character Entities</a></p>
<hr />
<h2>Non-breaking Space</h2>
<p>The most common character entity in HTML is the non-breaking space.</p>
<p>Normally HTML will truncate spaces in your text. If you write 10 spaces in
your text HTML will remove 9 of them. To add spaces to your text, use the &nbsp;
character entity.</p>
<hr />
<h2>The Most Common Character Entities:</h2>
<table class="ex" cellspacing="0" border="1" width="100%">
<tr>
<th align="left">Result</th>
<th align="left">Description</th>
<th align="left">Entity Name</th>
<th align="left">Entity Number</th>
</tr>
<tr>
<td> </td>
<td>non-breaking space</td>
<td>&nbsp;</td>
<td>&#160;</td>
</tr>
<tr>
<td><</td>
<td>less than</td>
<td>&lt;</td>
<td>&#60;</td>
</tr>
<tr>
<td>></td>
<td>greater than</td>
<td>&gt;</td>
<td>&#62;</td>
</tr>
<tr>
<td>&</td>
<td>ampersand</td>
<td>&amp;</td>
<td>&#38;</td>
</tr>
<tr>
<td>"</td>
<td>quotation mark</td>
<td>&quot;</td>
<td>&#34;</td>
</tr>
<tr>
<td>'</td>
<td>apostrophe </td>
<td>&apos; (does not work in IE)</td>
<td>&#39;</td>
</tr>
</table>
<h2>Some Other Commonly Used Character Entities:</h2>
<table class="ex" cellspacing="0" border="1" width="100%">
<tr>
<th align="left">Result</th>
<th align="left">Description</th>
<th align="left">Entity Name</th>
<th align="left">Entity Number</th>
</tr>
<tr>
<td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -