CSCI 121 - Lecture 3 - Formatting
Instructor's Class Notes
- <h1>, <h2>, ...<h6> - Headings
- h1 to h6 tags are used to define HTML headings.
- h1 is the largest and most important, h6 is the smallest and least important.
- <p> - Paragraph
- Paragraphs are important in making your text readable (no run-on).
- You cannot hand-format your HTML without the <p> tag because:
- You cannot be sure how HTML will be displayed.
- Large or small screens, and resized windows will create different results.
- With HTML, you cannot change the output by adding extra spaces or extra lines in your HTML code.
- The browser will remove any extra spaces and extra lines when the page is displayed.
- <br> - Line break
- The HTML
element defines a line break.
- Use <br> if you want a line break (a new line) without starting a new paragraph.
- The <br> tag is an empty tag, which means that it has no end tag.
- <pre> - Pre-formatted text
- Use <pre> if the text is already pre-formatted (retains spaces, breaks, etc).
- <b> - Bold text
- The <b> tag makes all text within bold.
- <strong> - Important text
- The <strong> tag makes all text within strong.
- <i> - Italic text
- The <i> tag makes all text within italics.
- <em> - Emphasized text
- The <em> tag makes all text within emphasised.
- IMPORTANT: Browsers display <strong> as <b>, and <em> as <i>. However, there is a difference in the meaning of these tags: <b> and <i> defines bold and italic text, but <strong> and <em> means that the text is "important" and they therefore are semantic tags, not formatting tags.
- <mark> - Marked text
- The <mark> tag makes all text within marked.
- <small> - Small text
- The <small> tag makes all text within small.
- <del> - Deleted text
- The <del> tag makes all text within
deleted.
- <ins> - Inserted text
- The <ins> tag makes all text within inserted.
- <sub> - Subscript text
- The <sub> tag makes all text within subscripted.
- <sup> - Superscript text
- The <sup> tag makes all text within superscripted.
* definitions from and inspired by w3school.com