
Ch. 4: HTML
- HTML = HyperText Markup Language.
- Plain text is simply formatted. Example: Source,
Page
- Basic markup
- Most tags have start and end versions enclosing text.
<tag> . . . </tag>.
- Tags are case-insensitive.
- Spaces and line breaks are ignored;
indenting does not matter.
- The contents of the file should be enclosed in <html> tags.
- Within the <html> pair should be <head> and <body> pairs.
- The <title> is displayed on the browser stripe.
- <p>, <i>, <b>, <tt>.
- The browser has great freedom formatting HTML
- Example: Source,
Page
- Headings: <h1>, <h2>, <h3>.
- Entities.
- Starts with &.
- Stuff that's markup otherwise: Say < for <
- Stuff not on the keyboard.
- ö for ö.
- ÷ for ÷.
- λ for λ.
- A partial
list of the major ones.
- A rather complete list.
- Example: Source,
Page
- Attributes
- Specified inside the opening tag.
- name=“value”
- Modify the behavior of the tag.
- Example: Source,
Page
- Links
- This is the hyper in hypertext:
Links take you somewhere else when clicked.
- <a href="URL">displayed text<a></a>
- Displays the text; clicking takes you to the URL
- Links may be absolute or relative.
- Absolute: A full URL, starting with the protocol.
- Relative: A partial URL starting from referring page.
- Use .. to go up.
- Example: Source,
Page
- Images.
- <img src="URL">
- Image stored in a separate file.
- Formats: GIF, JPEG, others.
- Inserted as a particularly large character.
- No <img></img>.
- Example: Source,
Page
- Colors.
- Sixteen pre-defined colors.
| black |
| silver |
| white |
| gray |
|
| red |
| fuchsia |
| maroon |
| purple |
|
| blue |
| navy |
| aqua |
| teal |
|
| lime |
| green |
| yellow |
| olive |
|
- Numeric colors
- Specify intensities for each red, blue and green, 0-255.
- Specify a hex number 00-FF (see p. 106).
| #FFFFFF |
| #000000 |
| #999999 |
| #00FF00 |
|
| #0000FF |
| #FFFF00 |
| #FF7F07 |
| #9C07FF |
|
| #77A361 |
| #66065A |
| #6DBFA7 |
| #8B9174 |
|
- Uses
- bgcolor=
- <font color="color">
- <body text=> <body link=>
- More...
- Example: Source,
Page
- Lists.
- <ul> for un-ordered (bullet) lists.
- <ol> for ordered (numbered) lists.
- List members denoted with <li>.
- Use <dl> for definitions. Contents are
<dt> and <dd>.
- Example: Source,
Page
- Tables
- Enclose in <table>.
- Tables a sequence of <tr>.
- Rows a sequence of <td>.
- Various attributes.
- Example: Source,
Page