HTML Basic Document
<html>
<head>
<title>Document name goes here</title>
</head>
<body>
Visible text goes here
</body>
</html>
Text Elements
<p>This is a paragraph</p>
<br> (line break)
<hr> (horizontal rule)
<pre>This text is preformatted</pre>
Logical Styles
<em>This text is emphasized</em>
<strong>This text is strong</strong>
<code>This is some computer code</code>
Physical Styles
<b>This text is bold</b>
<i>This text is italic</i>
Links, Anchors, and Image Elements
<a href="http://www.example.com/" rel="external nofollow" rel="external nofollow" >This is a Link</a>
<a href="http://www.example.com/" rel="external nofollow" rel="external nofollow" ><img src="URL"
alt="Alternate Text"></a>
<a href="mailto:webmaster@example.com" rel="external nofollow" >Send e-mail</a>A named anchor:
<a name="tips">Useful Tips Section</a>
<a href="#tips" rel="external nofollow" >Jump to the Useful Tips Section</a>
Unordered list
<ul>
<li>First item</li>
<li>Next item</li>
</ul>
Ordered list
<ol>
<li>First item</li>
<li>Next item</li>
</ol>
Definition list
<dl>
<dt>First term</dt>
<dd>Definition</dd>
<dt>Next term</dt>
<dd>Definition</dd>
</dl>
Tables
<table border="1">
<tr>
<th>someheader</th>
<th>someheader</th>
</tr>
<tr>
<td>sometext</td>
<td>sometext</td>
</tr>
</table>
Frames
<frameset cols="25%,75%">
<frame src="page1.htm">
<frame src="page2.htm">
</frameset>
Forms
<form action="http://www.example.com/test.asp" method="post/get">
<input type="text" name="lastname"
value="Nixon" size="30" maxlength="50">
<input type="password">
<input type="checkbox" checked="checked">
<input type="radio" checked="checked">
<input type="submit">
<input type="reset">
<input type="hidden">
<select>
<option>Apples
<option selected>Bananas
<option>Cherries
</select>
<textarea name="Comment" rows="60"
cols="20"></textarea>
</form>
Entities
< is the same as <
> is the same as >
© is the same as ©
Other Elements
<!-- This is a comment -->
<blockquote>
Text quoted from some source.
</blockquote>
<address>
Address 1<br>
Address 2<br>
City<br>
</address>
URL – Uniform Resource Locator(统一资源定位符)
遵守以下的语法规则:
scheme://host.domain:port/path/filename
解释:
- scheme – 定义因特网服务的类型。最常见的类型是 http
- host – 定义域主机(http 的默认主机是 www)
- domain – 定义因特网域名,比如 w3school.com.cn
- :port – 定义主机上的端口号(http 的默认端口号是 80)
- path – 定义服务器上的路径(如果省略,则文档必须位于网站的根目录中)。
- filename – 定义文档/资源的名称
URL Schemes
以下是其中一些最流行的 scheme:
Scheme | 访问 | 用于… |
---|---|---|
http | 超文本传输协议 | 以 http:// 开头的普通网页。不加密。 |
https | 安全超文本传输协议 | 安全网页。加密所有信息交换。 |
ftp | 文件传输协议 | 用于将文件下载或上传至网站。 |
file | 您计算机上的文件。 |
URL 编码会将字符转换为可通过因特网传输的格式。
URL 编码
URL 只能使用 ASCII 字符集来通过因特网进行发送。
由于 URL 常常会包含 ASCII 集合之外的字符,URL 必须转换为有效的 ASCII 格式。
URL 编码使用 “%” 其后跟随两位的十六进制数来替换非 ASCII 字符。
URL 不能包含空格。URL 编码通常使用 + 来替换空格。