Syntax
<!doctype html> <!-- indicates HTML5-->
<html>
<head>
<style>
<div>...</div>
</style>
<title> Title </title>
<nav> nav bar </nav>
...etc...
</head>
<body>
<form action="inc/script.php" method="get"> <!--or "post"-->
<input type="input-type">
...etc...
</body>
</html>
|
Basic elements
<!DOCTYPE> |
Declare document type, <!DOCTYPE HTML> for HTML5 |
<html></html> |
Entire document |
<head></head> |
Head of document |
<title></title> |
Title of document |
<nav></nav> |
Navigation bar |
<body></body> |
Body of the document |
<article></article> |
Article |
<section></section> |
Defines a section |
<aside></aside> |
Side block |
<footer></footer> |
Footer |
<p></p> |
Paragraph |
<hr> |
Horizontal rule |
<span></span> |
Defines a section in a document |
<!-- comment --> |
Insert comments |
Formatting text
<h1> to <h6> |
Heading levels |
<br> |
Line break |
<b>text</b> |
Bold |
<strong>text</strong> |
Bold, but less than <b> |
<i>italic</i> |
Italics |
<em>italic</em> |
Emphasis, italics |
<blockquote></blockquote> |
Quoted text |
<sup>super</sup> |
Superscript |
<sub></sub> |
Subscripted |
<small></small> |
Small text |
<style></style> |
Style information--CSS |
<div></div> |
Defines a section |
<pre></pre> |
Preformatted text |
UTF-8 is the default char set for HTML5.
HTML char set entities
n space tab |
  |
  |
m space tab |
  |
  |
non-breaking space |
|
  |
left arrow |
← |
← |
up arrow |
↑ |
↑ |
right arrow |
→ |
→ |
down arrow |
↓ |
↓ |
black spades |
♠ |
♠ |
black clubs |
♣ |
♣ |
black hearts |
♥ |
♥ |
black diamonds |
♦ |
♦ |
trademark |
™ |
™ |
copyright |
© |
© |
right double arrow |
» |
» |
1/4 |
¼ |
¼ |
1/2 |
½ |
½ |
3/4 |
¾ |
¾ |
Tables
<table></table> |
Defines a table |
<th></th> |
Table header cell |
<tr></tr> |
Table row |
<td></td> |
Table data cell |
<caption></caption> |
Defines table caption |
<table>
<th> first header text </th><th> second header text </th>
<tr> <!-- first row-->
<td> first cell text </td><td> second cell text </td>
</tr>
<tr> <!-- second row -->
<td> first cell text </td><td> second cell text </td>
</tr>
</table>
Links and media
<img src="dir/file.jpg"> |
defines an image |
<a href="http://url/...">link</a> |
hyperlink anchor |
<iframe></iframe> |
inline frame |
<object></object> |
imbeds an object |
<video></video> |
Insert video content |
<audio></audio> |
Insert audio content |
<embed></embed> |
Container for interactive content or external application |
<source></source> |
Multimedia: audio and video |
|
|
Ordered list
<ol></ol> |
Start and end tags |
<li> |
List item |
type |
Type of numbering |
A, a, 1, i, I |
start |
Starting value |
any number |
<ol>
| <ol type="a">
| <ol type="i" start="5">
<li> this
<li>that
</ol>
Unordered list
<ul></ul> |
Start and end tags |
<li> |
List item |
type |
Type of bullet |
disc, square, circle |
<ul>
| <ul type="circle">
<li> this
<li> that
<ul>
Definition list
<dl></dl> |
Start and end tags |
<dt> |
Term |
<dd> |
Definition |
<dl>
<dt>this
<dd>define this
<dt>that
<dd>define that
</dl>
Tags within the HEAD element
<title> |
Title of the page |
<meta> |
Meta data |
<link> |
<style> |
Can include CSS or a link to a CSS file |
<base> |
<script> |
<noscript> |
Use of attributes
TAG |
ATTRIBUTES THAT MODIFY THAT TAG |
<head> |
align, title, class, style, id |
<body> |
text, bgcolor, background, class, style, id, link, alink, vlink |
<p> |
align, class, style, id |
<hr> |
align, width, size, color, noshade, class, style, id |
General attributes
ATTRIBUTE |
DEFINITION |
VALUE |
align |
Horizontally align |
right, left, center |
valign |
Vertically align |
top, middle, bottom |
color |
color |
name, numeric, RGB, hex |
bgcolor |
Background color |
name, numeric, RGB, hex |
background |
Background image |
URL |
width |
Width of image, cells, or tables |
numeric |
height |
Height of image, cells, or tables |
numeric |
id, class, style |
Used in CSS |
CSS defined |
text |
Color of text |
name, numeric, RGB, hex |
link |
Color of links |
name, numeric, RGB, hex |
alink |
Color of active links |
name, numeric, RGB, hex |
vlink |
Color of visited links |
name, numeric, RGB, hex |
noshade |
Removes default shading |
Syntax is usually:
<tag attribute="value" /tag>, where value must be in quotes.
|