1 / 36

Essentials of HTML Class 4

Essentials of HTML Class 4. Instructor: Jeanne Hart jhartmccc@verizon.net. Creating Lists. In this lesson, you will learn to use HTML to organize your text into lists. Lesson 6 – Creating Lists. Types of Lists One way to organize the text in your Web pages is with lists. Lists con ’ t.

cai
Télécharger la présentation

Essentials of HTML Class 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Essentials of HTMLClass 4 Instructor: Jeanne Hart jhartmccc@verizon.net

  2. Creating Lists • In this lesson, you will learn to use HTML to organize your text into lists.

  3. Lesson 6 – Creating Lists Types of Lists • One way to organize the text in your Web pages is with lists.

  4. Lists con’t • In addition to the obvious benefit of being able to list items on a page, they also provide a design benefit by enabling you to break up long pages of ordinary paragraphs. HTML recognizes the following list types and has tags that correspond to each:

  5. Lists con’t • Bulleted (unordered) lists • Numbered/lettered (ordered) lists • Definition lists

  6. Tip • You should use ordered lists when the items in the list must be followed in a specific order, and use unordered lists when they do not. • You generally use definition lists for terms and their definitions, but they can have other uses as well.

  7. Bulleted List • A bullet (usually a solid circle) appears in front of each item in an unordered list. • HTML automatically creates the bullet when you use the unordered list tag (<ul>) together with the list item tag (<li>).

  8. Lists con’t • Although the following sample HTML shows each list item as a single line of text, your list items can be as long as you want:

  9. Bulleted Lists con’t • <ul> • <li>first item in the list</li> • <li>second item in the list</li> • <li>third item in the list</li> • </ul>

  10. Formatting Bulleted Lists • HTML automatically adds a solid circle in front of each list item as a bullet, but you have two other choices. • Using style sheet tags you can select one of two other bullet types: a square or a hollow circle. • You can see how your HTML document would look if you chose to use a square bullet instead of the standard solid circle.

  11. Lists Con’t • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> • <head><title>Bullet Options</title>head> • <body> • <ul class="square"> • <li>a list item</li><li>another list item</li></ul><ul class="image"><li>a list item</li><li>another list item</li> • </ul> • </body> • </html>

  12. Very Important! • What is going to happen if you don’t close the ul tag?

  13. Numbered Lists • If the items in your list should follow a specific order, as in recipes or instructions, you want to use the ordered list tag (<ol>). With this tag, HTML automatically numbers or letters your items for you. Here's an example: • <ol> • <li>first item in the list</li> • <li>second item in the list</li> • <li>third item in the list</li> • </ol>

  14. Lists con’t • Did you notice how similar the two list samples are? • Both the <ul> and <ol> tags call for the individual list items to be identified with the <li> tag. • Like the <ul> tag, HTML has an automatic style for the list items within the <ol> tag. HTML automatically numbers the items with the familiar Arabic numerals (1, 2, 3, and so on). What's more, it automatically renumbers the list items if you decide to add or delete items later.

  15. Definition Lists • If you need it, HTML has one more type of list available to you: the definition list, which uses the <dl> tag. Rather than using the usual <li> tag to specify the items in the list, this type of list uses the <dt> tag (for definition terms) and the <dd> tag for their definitions. Following is an example of the HTML for a definition list. • <dl><dt>The Definition Term</dt><dd>Is defined below the term.</dd></dl>

  16. Summary In this lesson, you've learned: • HTML recognizes three different list types: unordered (bulleted), ordered (numbered), and definition. • Rather than the default bullet style (a solid circle), style sheets enable you to select three other bullet types: a square, a hollow circle, or an image of your own.

  17. Creating Tables • In this lesson, you will learn how to build tables using HTML, and how to control the layout and appearance of a Web page using tables.

  18. Simple Tables • Traditionally, tables have been used for displaying tabular data (such as numbers) in rows and columns. The flexibility of HTML, however, enables Web developers to create tables that display more than just numbers.

  19. Caution • Although HTML tables look similar to your favorite spreadsheet, HTML tables don't perform mathematical functions.

  20. Tables con’t • HTML tables are not difficult to create, but they do require some organization. All HTML tables begin with the opening <table> tag and end with the closing </table> tag. In between those tags are three other tags to be aware of, as follows:

  21. Tables con’t • <tr> defines a horizontal row. • <td> defines a data cell within that row. • <th> specifies a data cell as a table heading. In newer browsers, a table heading cell is formatted as centered and bold.

  22. Tip • The World Wide Web Consortium's Web site (www.w3.org/TR/REC-html40/struct/tables.html) has detailed descriptions of all the attributes available for tables, as well as examples of how you can use them.

  23. Advanced Tables • HTML contains two more attributes that you should be aware of when formatting tables. The colspan (which causes a cell to span two or more columns) and rowspan (which causes a cell to span two or more rows) attributes are invaluable when creating complex tables. • Since this is an Essentials of HTML class I won’t be going over these two advanced tags.

  24. Tip • Even if you don't plan to place a border around the cells in your table, it's much easier to see how your HTML commands are interpreted by your Web browser when you have the borders turned on (<table border="1">).

  25. Style Sheets • HTML was never meant to control the form or appearance of Web pages. It's a language that defines the structure and function of elements on a page. It lets the Web browser decide how those elements should actually appear.

  26. What can Style sheets do for me? • You can separate form and structure. • You can make smaller, faster pages. • You can maintain or update many pages

  27. 1. You can Separate Form from Structure • HTML was never meant to control the form or appearance of Web pages. • It's a language that defines the structure and function of elements on a page. • It lets the Web browser decide how those elements should actually appear.

  28. 2. You can make smaller, faster pages • Stylesheets are simple text, just like HTML. • With CSS, you can do things that you previously had to resort to spacer GIFs for. • Cascading stylesheets mean fewer table tags and other HTML tags cluttering up your code.

  29. 3. You can maintain or update many pages faster and easier. • Without stylesheets, if we wanted to update the font used for body text across my entire site, we'd have to manually edit each page. • The whole point of stylesheets is to separate form and structure.

  30. Three Types of Style Sheets • In-line: styles for specific tags on a page • e.g., change a paragraph to blue • e.g., change h1 tag to 18 pt. (normally 24pt); • Embedded: rules that apply to a specific page; • External/Linked: set up styles in a separate css page and apply to all pages.

  31. Rules • Style sheets contain one thing: rules. Each rule is a formatting instruction that • applies to a part of your Web page. A style sheet can contain a single rule, or it can hold dozens (or even hundreds) of them.

  32. Defining the Rules • Style sheet rules are made up of • selectors (the HTML tag that receive the style) and • declarations(the style sheet properties and their values). • In the following example, the selector is the body tag and the declaration is made up of the style property (background) and its value (black). • This example sets the background color for the entire html to black. body{background:black}

  33. Rules con’t • In a style sheet, the HTML tag is not surrounded by brackets as it would be in the HTML document, and the declaration is surrounded by curly braces. • Declarations can contain more than one property.

  34. Inline Styles • In inline style loses many of the advantages of style sheets by mixing content with presentation. Not only that it is not recommended by the W3C. • The example shows how to change the color and the left margin of a paragraph: • <p style="color:sienna;margin-left:20px">This is a paragraph.</p>

  35. Embedded Style Sheet • The style properties are includedwithin Embedded Style Sheet • An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section of an HTML page, by using the <style> tag, like this: • <head><style type="text/css">hr {color:sienna;}p {margin-left:20px;}body {background-image:url("images/back40.gif");}</style></head> • the <style> tags) at the top of the HTML document. A style assigned to a particular tag applies to all those tags in this type of document.

  36. External/Linked Style Sheet • An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section: • <head><link rel="stylesheet" type="text/css" href="mystyle.css" /></head> • An external style sheet can be written in any text editor. The css file should not contain any html!

More Related