HTML & XHTML CheatSheet

HTML 4 Transitional Doctype

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

XHTML Transitional Doctype

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

XHTML Strict Doctype

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Link a StyleSheet

<link rel="stylesheet" href="/style.css" type="text/css" />

RSS Autodiscovery

<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="/rss.xml" />

META Description

<meta name="description" content="About a Page" />

META Keywords

<meta name="keywords" content="go, here" />

Table

<table>
 <tr>
    <th>Header A</th>
    <th>Header B</th>
 </tr>
 <tr>
    <td>A One</td>
    <td>B One</td>
 </tr>
 <tr>
    <td>A Two</td>
    <td>B Two</td>
 </tr>
</table>

Left & Right Frames

<frameset cols="25%,75%">
  <frame src="left.html" />
  <frame src="right.html" />
</frameset>

Top & Bottom Frames

<frameset rows="10%,90%">
  <frame src="top.html" />
  <frame src="bottom.html" />
</frameset>

File Upload

<form method="post" enctype="multipart/form-data" action="/up">
 <input type="file" name="file_name" />
</form>

Option Select List

<select name="fruit">
  <option value="1" selected="selected">Apple</option>
  <option value="2">Orange</option>
</select>

Abbreviation

<abbr title="United States">US</abbr>

Definition

<dl>
  <dt>Word</dt>
  <dd>Definition</dd>
</dl>

Ordered / Numbered List

<ol>
  <li>One</li>
  <li>Two</li>
</ol>

Bullet List

<ul>
  <li>One</li>
  <li>Two</li>
</ul>

Basic HTML

Link to another page

<a href="https://example.com/">Text for link</a>