Survey of HTML Tags
Lecture Notes for CS349W
Fall Quarter 2008
John Ousterhout
- Only a small set of HTML tags are used commonly in Web
applications. Many are obsolete or non-portable. Here are the
tags that you should have in your repertoire:
- <p>: new paragraph
- <br>: force a line break within the same paragraph
- <h1>, <h2>, etc.: headings
- <b>, <i>: boldface and italic
- <q>: an inline quote
- <pre>: typically used for code: indented with a fixed-width font,
and spaces are significant (e.g., newlines are preserved)
- <title>: used in the <head> section to specify a title for the
page, which will appear in the title bar for the browser window
- <img href="foo">: image
- Lists:
- <ul> + <li>: unordered list (with bullets)
- <ol> + <li>: ordered list (numbered)
- <dl> + <dt> + <dd>: definition list
- Tables
- <frame> or <iframe>: a rectangular region with its own separate
URL; allows you to create pages that combine content from several
different sources (mashups).
- <form>, <input>, <textarea>, <select>, etc.: used to create forms
where users can input data. We will discuss these in more detail later.
- <div> and <span>: used for grouping related elements.
- With <div> the related elements occupy one or more entire lines
(there's a forced line break before and after the <div>).
A <div> is an example of a "block-level element"; <p>
and <table> are other examples.
- <span> is used for grouping within a line: no forced line breaks.
- These elements are used in conjunction with CSS, and also for
manipulating the page structure dynamically; we will see more
about them later.
- <script>: used to add Javascript to a page for dynamic behaviors.
More on this later.