HTML 快速参考

来自 CtrlASD.com 的 HTML 快速参考。可以打印它,以备日常使用。

HTML Basic Document

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

Text Elements

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

Logical Styles

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

Physical Styles

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

Links, Anchors, and Image Elements

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

Unordered list

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

Ordered list

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

Definition list

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

Tables

  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>

Frames

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

Forms

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

Entities

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

Other Elements

  1. <!-- This is a comment -->
  2. <blockquote>
  3. Text quoted from some source.
  4. </blockquote>
  5. <address>
  6. Address 1<br>
  7. Address 2<br>
  8. City<br>
  9. </address>