Chapter 2

html

HTML 基础文档

1<html>
2    <head>
3        <title>Document name goes here</title>
4    </head>
5    <body>
6    Visible text goes here
7    </body>
8</html>

文本元素

1<p>This is a paragraph</p>
2<br> (line break)
3<hr> (horizontal rule)
4<pre>This text is preformatted</pre>

链接、锚、图像元素

1<a href="http://www.example.com/">This is a Link</a>
2<a href="http://www.example.com/"><img src="URL" alt="Alternate Text"></a>
3<a href="mailto:webmaster@example.com">Send e-mail</a>A named anchor:
4<a name="tips">Useful Tips Section</a>
5<a href="#tips">Jump to the Useful Tips Section</a>

无序列表

1<ul>
2    <li>First item</li>
3    <li>Next item</li>
4</ul>

有序列表

1<ol>
2    <li>First item</li>
3    <li>Next item</li>
4</ol>

定义列表

1<dl>
2    <dt>First term</dt>
3    <dd>Definition</dd>
4    <dt>Next term</dt>
5    <dd>Definition</dd>
6</dl>

表格

 1<table border="1">
 2  <tr>
 3    <th>someheader</th>
 4    <th>someheader</th>
 5  </tr>
 6  <tr>
 7    <td>sometext</td>
 8    <td>sometext</td>
 9  </tr>
10</table>

框架

1<frameset cols="25%,75%">
2  <frame src="page1.htm">
3  <frame src="page2.htm">
4</frameset>

表单

 1<form action="http://www.example.com/test.asp" method="post/get">
 2  <input type="text" name="lastname" value="Nixon" size="30" maxlength="50">
 3  <input type="password">
 4  <input type="checkbox" checked="checked">
 5  <input type="radio" checked="checked">
 6  <input type="submit">
 7  <input type="reset">
 8  <input type="hidden">
 9  <select>
10    <option>Apples
11    <option selected>Bananas
12    <option>Cherries
13  </select>
14  <textarea name="Comment" rows="60" cols="20"></textarea>
15</form>

实体

1&lt; is the same as <
2&gt; is the same as >
3&#169; is the same as ©

其他元素

1<blockquote>
2Text quoted from some source.
3</blockquote>
4<address>
5Address 1<br>
6Address 2<br>
7City<br>
8</address>

逻辑样式

1<em>This text is emphasized</em>
2<strong>This text is strong</strong>
3<code>This is some computer code</code>

物理样式

1<b>This text is bold</b>
2<i>This text is italic</i>