1 / 32

Introduction to Web Site Development

John Hurley Department of Computer Science California State University, Los Angeles. Introduction to Web Site Development. Lecture 4: Favicons Tables and Frames HTML5 Semantic Elements. Favicons . Site addresses often appear in browser URL windows with small icons

bena
Download Presentation

Introduction to Web Site Development

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. John Hurley Department of Computer Science California State University, Los Angeles Introduction to Web Site Development Lecture 4: Favicons Tables and Frames HTML5 Semantic Elements

  2. Favicons • Site addresses often appear in browser URL windows with small icons • These are called favicons • They are traditionally in the .ico file format, although they can now be in .gif or .png with some browsers • You can create one from any of the main image formats at http://tools.dynamicdrive.com/favicon/ • The image must be perfectly square and is typically 16px by 16 px • Put the favicon file in the root directory of the site!

  3. Favicons • html syntax to link favicon to document: • <link rel="icon" href="[path]/favicon.ico" /> • Where [path] is the relative path to the favicon file. • Favicons may not appear correctly when not placed in the root directory of the site. On cs1, this will be your public_html directory. It’s not clear what it would be on your hard drive, so don’t bother to try to get favicons to work locally. Just make them work on the server. • On a server in which you control the domain name (eg. www.mysite.com), the path is normally just “/” but on our cs1 accounts, think out the relative path to public_html • Don't call the file anything other than favicon.ico

  4. The TABLE Element (Basics) • Description: Use the table element to place data in a two-dimensional table • Placement: Flow Content (i.e. don’t put a table inside a paragraph or in-between text) • Content: caption, colgroup, thead, tfoot, tbody, tr, td elements

  5. The TABLE Element (Basics) • Uses: • Obvious uses: some information lends itself to presentation in tables: • http://www.myguideireland.com/distance-chart-in-miles • Tables can be used as the top-level layout of a page, eg http://boise.craigslist.org • Tables can be a little confusing to set up, but the formatting is very rigid and thus predictable • Page layout using tables is regarded as a little old fashioned. Layout using CSS (which we’ll learn about soon) is more powerful

  6. The TABLE Element (Syntax) • Example <table> <tr> <td>1<sub>1</sub></td> <td>1<sub>2</sub></td> </tr> <tr> <td>2<sub>1</sub></td> <td>2<sub>2</sub></td> </tr> </table>

  7. The THEAD Element (Basics) • Description: Use the thead element to mark one or more rows of a table, starting from the first row, as heading rows • Placement: thead must be a child of table • Content: 0 or more tr elements.

  8. The TBODY Element (Basics) • Description: Use the tbody element to mark one or more rows of a table, starting after the last thead or tfoot row, as body rows. • Placement: tbody must be a child of table and come after thead (if there is a thead) • Content: Zero or more tr elements.

  9. The TFOOT Element (Basics) • Description: Use the tfoot element to mark one or more rows of a table, starting from the bottom row, as footing rows. Useful for summarizing data • Placement: tfoot must be a child of table, and must be placed *before* the tbody • Content: Zero or more tr elements • tfoot may be rendered identically to tbody by default; we will see how to change this with CSS

  10. Tr (Basics) • Use the tr element to begin a new row in a table • Placement: tr must be a child of table, thead, tfoot, or tbody • Content: When parent is thead, zero or more th elements; otherwise, zero or more elements.

  11. The TD/TH Elements (Basics) • Description: Use td/th to add table data to the current row of the table • Placement: td / th must be child of tr • Th for headings, usually in thead • Td for data, usually in tbody

  12. The TD/TH Elements (Attributes) • Optional Attributes • colspan: The number of columns this cell will span. • rowspan: The number of rows this cell will span. • headers: A string containing a sequence of html identifiers that are associated with table headers. Used by speech readers to help the blind make sense of table data. Use in td with reference to id attributes in the <th> elements.

  13. The TD/TH Elements (Syntax) <table border = "1"> <thead> <tr> <th>1</th><th>2</th><th>3</th> </tr> </thead> <tbody> <tr> <td>1<sub>1</sub></td> <td>1<sub>2</sub></td> <td>1<sub>3</sub></td> </tr> <tr> <td>2<sub>1</sub></td> <td>2<sub>2</sub></td> <td>2<sub>3</sub></td> </tr> </tbody> </table>

  14. The TABLE Element (Attributes) • Common Optional Attributes • Title: Specify a tool tip when the mouse hovers over the table. Note that this is an attribute; if you add a title element, it will appear as the page title. • Cellpadding • Border • Summary (used by screen readers)

  15. The Caption Element (Basics) • Description: Use the caption element to define caption text for the table (optional) • Placement: caption must be a child of table • <caption>This is a table</caption>

  16. More complete table sample <!DOCTYPE html> <html> <head> <title>Example Page</title> </head> <body> <table border = "1" width = "30%“ summary = “this is my table”> <caption> Multiplication Table </caption> <thead> <tr> <th>#</th><th>1</th><th>2</th><th>3</th> </tr> </thead> <tfoot> <tr> <td colspan = "4">Learn this and you will prosper</td> </tr> </tfoot>

  17. More complete table sample <tbody align = "center"> <tr> <td>1</td><td>1</td><td>2</td><td>3</td> </tr> <tr> <td>2</td><td>2</td><td>4</td><td>6</td> </tr> <tr> <td>3</td><td>3</td><td>6</td><td>9</td> </tr> </tbody> </table> </body> </html>

  18. Frames • Display more than one document in a page • Very popular for links, ads, and navigation in the late 90’s, now regarded as outdated • No body tags! <html> <head> <title>Example Page</title> </head> <frameset cols="50%, 50%"> <frame src="http://www.cheaprx.com"> <frame src="http://www.scamcentral.com"> <noframes> Text to be displayed in browsers that do not support frames </noframes> </frameset> </html>

  19. Frames • abused by designers who made content look as if it came from different sites than it really did <head> <title>Paintings by John Hurley</title> <link rel = "icon" href = "favicon.ico" type = "image/x-icon" /> <link rel = "shortcut icon" href = "favicon.ico" type = "image/x-icon"/> </head> <frameset cols="90%"> <frame src="http://www.artchive.com/artchive/l/leonardo/monalisa.jpg" /> <noframes> Text to be displayed in browsers that do not support frames </noframes> </frameset>

  20. Frames • Frames are out of fashion for myriad reasons: • confusing • interfere with bookmarking • interfere with back button • interfere with printing

  21. Frames • HTML5 standard will drop the frame and frameset elements ( although they may still display OK) • One type of frame however, will still exist in HTML5, the inline frame element, iframe

  22. The IFRAME Element (Basics) • Description: Use the iframe to load the contents of another HTML page in a child window within the current document. • No frameset • Content: Fallback text, in case the web browser does not support inline frames.

  23. The IFRAME Element (Attributes) • Optional Attributes • src: The URL of the document to load within the frame. Can be absolute or relative. • id: a name of the frame window (useful when we do JavaScript later on). • width: The desired width of the frame window. • height: The desired height of the frame window. • scrolling: whether to include a scrollbar. Default is auto

  24. The IFRAME Element (Syntax) <head> <title>Paintings by John Hurley</title> <link rel = "icon" href = "favicon.ico" type = "image/x-icon" /> <link rel = "shortcut icon" href = "favicon.ico" type = "image/x-icon"/> </head> <body> <h2>Paintings by John Hurley</h2> <iframe height = "800px" width = "700px" src="http://www.artchive.com/artchive/l/leonardo/monalisa.jpg"> Your web browser does not support inline frames! </iframe> </body>

  25. HTML5 Time Element • Time • Tax Day: <time datetime = "2013-04-15">4-15-2013</time>

  26. HTML5 Semantics • The trend in HTML is towards separating out semantics (meaning and structure) from presentation (formatting) • The div element has traditionally been used to identify different parts of a document for different formatting • Over time conventions have developed that provide some information about semantics • For example, a div used for navigation links is often called “nav”) • These are not standardized enough to be very useful

  27. HTML5 Semantics • HTML5 contains new elements that replace some of the typical divs. • These can be used to apply formatting with css (see next week’s material) • Since they are standardized, they can be useful to programs that parse your HTML for various purposes • Search engines • Screen readers • Machine Translators • Future applications that we don’t even have to know about!

  28. Example of a pre-HTML5 document structure

  29. HTML 5 Equivalent Many common elements for which you would use divs now have built in elements

  30. Slightly More Complex Version: Many common elements for which you would use divs now have built in elements

  31. HTML 5 Semantics <body> <header>...</header> <nav>...</nav> <article> <section> ... </section> </article> <aside>...</aside> <footer>...</footer> </body>

  32. Metadata • <meta charset = “utf-8”> • Specifies character encoding (code for mapping characters to binary representations) • Required in HTML5

More Related