|
22 Tag Examples
HTML Basic Document
<
html
>
<
head
>
'content of head is not displayed in browser
<
title
></
title
>
'document name - is displayed in the browser title bar
</
head
>
<
body
>
'content goes here and is displayed in the browser
</
body
>
</
html
>
Comments - anything between
<!-- and -->
is treated as a comment. Example:
<!-- Comment -->
Entities
<
less than
<
>
greater than
>
&
ampersand
&
© copyright
&
#169
Heading Elements
<
h1
>
large
</
h1
>
<
h2
>
. . .
</
h2
>
<
h3
>
. . .
</
h3
>
<
h4
>
. . .
</
h4
>
<
h5
>
. . .
</
h5
>
<
h6
>
small
</
h6
>
Text Elements
<
p
>
This is a paragraph
</
p
>
<
br
>
(line break)
<
hr
>
(horizontal rule)
<
pre
>
This text is preformatted
</
pre
>
Physical Styles
<
b
>
This text is bold
</
b
>
<
i
>
This text is italic
</
i
>
Logical Styles
<
em
>
This text is emphasized
</
em
>
<
strong
>
This text is strong
</
strong
>
<
code
>
This is some computer code
</
code
>
Links (anchors)
<
a
href
=
"
http://www.garybeene.com
/"
>
This is a Link
</
a
>
<
a
href
=
"
http://www.garybeene.com
/"
><
img
src
=
"URL"
alt
=
"Alternate Text"
></
a
>
<
a
href
=
"
mailto:someone@microsoft.com
"
>
Send e-mail
</
a
>
Named anchors
<
a
name
=
"tips"
>
Useful Tips Section
</
a
>
'create an anchor
<
a
href
=
"#tips"
>
Jump to the Useful Tips Section
</
a
>
'link to the anchor
Graphical Elements
<
img
src
=
"name"
>
Adds an image
<
img
src
=
"name"
align
=?
>
Aligns an image: left, right, center; bottom, top, middle
<
img
src
=
"name"
border
=
12
>
Sets size of border around an image
<
hr
>
Inserts a horizontal rule
<
hr
size
=
5
>
Sets size (height) of rule
<
hr
width
=
100
>
Sets width of rule, in percentage or absolute value
<
hr
noshade
>
Creates a rule without a shadow
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
>
Table Attributes
<
table
border
=#
>
Sets width of border around table cells
<
table
cellspacing
=#
>
Sets amount of space between table cells
<
table
cellpadding
=#
>
Sets amount of space between a cell's border and its contents
<
table
width
=# or %
>
Sets width of table - in pixels or as a percentage of document width
<
tr
align
=?
>
or
<
td
align
=?
>
Sets alignment for cell(s) (left, center, or right)
<
tr
valign
=?
>
or
<
td
valign
=?
>
Sets vertical alignment for cell(s) (top, middle, or bottom)
<
td
colspan
=#
>
Sets number of columns a cell should span
<
td
rowspan
=#
>
Sets number of rows a cell should span (default=1)
<
td
nowra
p
>
Prevents the lines within a cell from being broken to fit
Frames
<
frameset
cols
=
"25%,75%"
>
'pixels or percentage of width, also "rows="
<
frame
src
=
"page1.htm"
>
<
frame
src
=
"page2.htm"
>
<
noframes
>
... content to display if browser does not support frames
</
noframes
>
</
frameset
>
Frames Attributes
<
frame
src
=
"URL"
>
Specifies which HTML document should be displayed
<
frame
name
=
"name"
>
Names the frame, or region, so it may be targeted by other frames
<
frame
marginwidth
=#
>
Defines the left and right margins for the frame; must be equal to or greater than 1
<
frame
marginheight
=#
>
Defines the top and bottom margins for the frame; must be equal to or greater than 1
<
frame
scrolling
=VALUE
>
Sets whether the frame has a scrollbar; value may equal "yes," "no," or "auto." The default, as in ordinary documents, is auto.
<
frame
noresize
>
Prevents the user from resizing a frame
Forms
<
form
action
=
"
http://www.somewhere.com/somepage.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
>
|