dc67405355bc4639d787cbb5781423c2.ppt
- Количество слайдов: 43
2. 1 Origins and Evolution of HTML - HTML was defined with SGML - Original intent of HTML: General layout of documents that could be displayed by a wide variety of computers - Recent versions: - HTML 4. 0 – 1997 - Introduced many new features and deprecated many older features - HTML 4. 01 - 1999 - A cleanup of 4. 0 - XHTML 1. 0 - 2000 - Just 4. 01 defined using XML, instead of SGML - XHTML 1. 1 – 2001 - Modularized 1. 0, and drops frames - Although the value of the consistent and coherent syntax rules of XHTML were widely recognized and accepted, its draconian error handling was not, so XHTML documents are served as HTML - W 3 C worked on XHTML 2. 0; WHAT worked on a new version of HTML Chapter 2 © 2012 by Addison Wesley Longman, Inc. 1
2. 1 Origins and Evolution of HTML (continued) - In 2009, XHTML 2. 0 was stopped; W 3 C took over development of HTML 5 - Reasons to use XHTML syntax rules: 1. HTML has lax syntax rules, leading to sloppy and sometimes to ambiguous documents - XHTML syntax is much more strict, leading to clean and clear documents in a standard form 2. HTML processors do not even enforce the few syntax rule that do exist in HTML 3. The syntactic correctness of XHTML documents can be validated - In this book, HTML 5 is used, but with XHTML syntax rules 2. 2 Basic Syntax - Elements are defined by tags (markers) - Tag format: - Opening tag:
2. 2 Basic Syntax (continued) - Not all tags have content - If a tag has no content, its form is
2. 3 Standard XHTML Document Structure - Every XHTML document must begin with: - ,
2. 4 Basic Text Markup - Text is normally placed in paragraph elements - Paragraph Elements - The
tag breaks the current line and inserts a blank line - the new line gets the beginning of the content of the paragraph - The closing tag is required in XHTML, not in HTML
Greetings from your Webmaster!
Chapter 2 © 2012 by Addison Wesley Longman, Inc. 5
2. 4 Basic Text Markup (continued) - Line breaks - The effect of the tag is the same as that of
, except for the blank line (in HTML, it could be just ) - No closing tag! - Example of paragraphs and line breaks On the plains of hesitation
bleach the bones of countless millions
who, at the dawn of victory sat down to wait, and waiting, died. - Typical display of this text: On the plains of hesitation bleach the bones of countless millions who, at the dawn of victory sat down to wait, and waiting, died. - Preserving whitespace - The text content of aelement is displayed as it is entered Chapter 2 © 2012 by Addison Wesley Longman, Inc. 6
2. 4 Basic Text Markup (continued) - Headings - Six sizes, 1 - 6, specified with
2. 4 Basic Text Markup (continued) - Blockquotes - Content of
- To set a block of text off from the normal flow and appearance of text - Browsers often indent, and sometimes italicize - Font Styles and Sizes (can be nested) - Emphasis - (often set in italics) - Strong - (often set in boldface) - Monospace - (often set in Courier) Chapter 2 © 2012 by Addison Wesley Longman, Inc. 8
2. 4 Basic Text Markup (continued) - , , and are not affected if they appear in the content of a , unless there is a conflict (e. g. , (italics)) - Superscripts and subscripts - Subscripts with - Superscripts with Example: x23 Display: x 23 - Inline versus block elements - Block elements CANNOT be nested in inline elements (in XHTML) Chapter 2 © 2012 by Addison Wesley Longman, Inc. 9
2. 4 Basic Text Markup (continued) - All of this font size and font style stuff can be done with style sheets, but these tags are not yet deprecated - Character Entities Char. Entity & < > " ' ¼ ½ ¾ & < > " ' &frac 14; &frac 12; &frac 34; ° (space) Meaning Ampersand Less than Greater than Double quote Single quote One quarter One half Three quarters Degree Non-breaking space - Horizontal rules -
draws a line across the display, after a line break Chapter 2 © 2012 by Addison Wesley Longman, Inc. 10
2. 5 Images - Formats: - GIF (Graphic Interchange Format) - 8 -bit color (256 different colors) - JPEG (Joint Photographic Experts Group) - 24 -bit color (16 million different colors) - Both use compression, but JPEG compression is better - Portable Network Graphics (PNG) - Relatively new - Should eventually replace both gif and jpeg - Files are bigger than jpeg – no lost data! - Images are inserted into a document with the tag with the src attribute - The alt attribute is required by XHTML - Purposes: 1. Non-graphical browsers 2. Browsers with images turned off
- The
tag has 30 different attributes, including width and height (in pixels) Chapter 2 © 2012 by Addison Wesley Longman, Inc. 11
2. 5 Images (continued)
1960 Cessna 210 577 hours since major engine overhaul 1022 hours since prop overhaul Buy this fine airplane today at a remarkably low price Call 999 -555 -1111 today!
2. 5 Images (continued) Chapter 2 © 2012 by Addison Wesley Longman, Inc. 13
2. 5 Images (continued) - HTML Validation - Replace DOCTYPE with: (the anchor tag) - The content of is the visual link in the document Chapter 2 © 2012 by Addison Wesley Longman, Inc. 14
2. 6 Hypertext Links (continued)
1960 Cessna 210 Information on the Cessna 210
Chapter 2 © 2012 by Addison Wesley Longman, Inc. 15
2. 6 Hypertext Links (continued) Chapter 2 © 2012 by Addison Wesley Longman, Inc. 16
2. 6 Hypertext Links (continued) - If the target is not at the beginning of the document, the target spot must be marked - Target labels can be defined in many different tags with the id attribute, as in Info on C 210 Chapter 2 © 2012 by Addison Wesley Longman, Inc. 17
2. 7 Lists - Unordered lists - The list is the content of the
- tag - List elements are the content of the
- tag
Some Common Single-Engine Aircraft - Cessna Skyhawk
- Beechcraft Bonanza
- Piper Cherokee
- tag - Each item in the display is preceded by a sequence value Chapter 2 © 2012 by Addison Wesley Longman, Inc. 18
2. 7 Lists (continued)
- Set mixture to rich
- Set propeller to high RPM
- Set ignition switch to "BOTH"
- Set auxiliary fuel pump switch to "LOW PRIME"
- When fuel pressure reaches 2 to 2. 5 PSI, push starter button
2. 7 Lists (continued) - Definition lists (for glossaries, etc. ) - List is the content of the
- tag - Terms being defined are the content of the
- tag - The definitions themselves are the content of the
- tag
Single-Engine Cessna Airplanes - 152
- Two-place trainer
- 172
- Smaller four-place airplane
- 182
- Larger four-place airplane
- 210
- Six-place airplane - high performance
2. 8 Tables - A table is a matrix of cells, each possibly having content - The cells can include almost any element - A table is specified as the content of a
| tag - The contents of a data cell is specified as the content of a | tag
tag to specify that the label must span some number of columns | Fruit Juice Drinks | Orange | Apple | Screwdriver | | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Fruit Juice Drinks | Apple | Orange | Screwdriver | …
|---|---|---|---|
2. 8 Tables (continued) - Table Sections - Header, body, and footer, which are the elements: thead, tbody, and tfoot - If a document has multiple tbody elements, they are separated by thicker horizontal lines - Uses of Tables - In the past, tables were used to align elements in rows and columns – general layout - That use of tables is now frowned upon - Use Cascading Style Sheets to place elements in rows and columns – general layout - Use tables only when the information is naturally tabular Chapter 2 © 2012 by Addison Wesley Longman, Inc. 25
2. 9 Forms - A form is the usual way information is gotten from a browser user to a server - HTML has tags to create a collection of objects that implement this information gathering - The objects are called widgets or controls or components (e. g. , radio buttons and checkboxes) - When the Submit button of a form is clicked, the form’s values are sent to the server for processing - All of the widgets, or components of a form are defined in the content of a
2. 9 Forms (continued) - The method attribute of
2. 9 Forms (continued) - If you don’t want to allow the user to type more characters than will fit, set maxlength, which causes excess input to be ignored - Widgets should be placed in label elements 2. Password – just like text except asterisks are displayed, rather than the input characters 3. Checkboxes - to collect multiple choice input - Every checkbox requires a value attribute, which is the widget’s value in the form data when the checkbox is ‘checked’ - To initialize a checkbox to ‘checked’, the checked attribute must be set to "checked" Chapter 2 © 2012 by Addison Wesley Longman, Inc. 28
" src="https://present5.com/presentation/dc67405355bc4639d787cbb5781423c2/image-29.jpg" alt="2. 9 Forms (continued) - Widgets (continued) Grocery Checklist
4. Radio Buttons - collections of checkboxes in which only one button can be ‘checked’ at a time - Every button in a radio button group MUST have the same name Chapter 2 © 2012 by Addison Wesley Longman, Inc. 29
2. 9 Forms (continued) - Widgets (continued) 4. Radio Buttons (continued) - If no button in a radio button group is ‘pressed’, the browser often ‘presses’ the first one Age Category
2. 9 Forms (continued) -Widgets (continued) 5. The
2. 9 Forms (continued) - Widgets (continued) 5.
2. 9 Forms (continued) - Widgets (continued) - After clicking the menu: - After changing size to 2: Chapter 2 © 2012 by Addison Wesley Longman, Inc. 33
2. 9 Forms (continued) -Widgets (continued) 6. Text areas - created with
2. 9 Forms (continued) - Widgets (continued) 7. Reset and Submit buttons - Both are created with - Submit has two actions: 1. Encode the data of the form 2. Request that the server execute the server-resident program specified as the value of the action attribute of
2. 10 HTML 5 - Using HTML 5 is a bit premature, because there are still many browsers in use that do not support it - Code can be included in a document to detect HTML 5 features and produce a message to the user – This is covered in Chapter 4 - The audio Element - Prior to HTML 5, a plug-in was required to play sound while a document was being displayed - Audio encoding algorithms are called audio codecs – e. g. , MP 3, Vorbis - Coded audio data is stored in containers—e. g. , Ogg, MP 3, and Wav (file name extension indicates the container, not the audio code) - Vorbis code is stored in Ogg containers - MP 3 code is stored in MP 3 containers - Wav code is stored in Wav containers Chapter 2 © 2012 by Addison Wesley Longman, Inc. 36
2. 10 HTML 5 (continued) - The audio Element (continued) - General syntax: - Browser chooses the first audio file it can play and skips the content; if none, it displays the content - Different browsers have different audio capabilities - The controls attribute, which is set to "controls“, creates a start/stop button, a clock, a progress slider, total time of the file, and a volume slider Chapter 2 © 2012 by Addison Wesley Longman, Inc. 37
2. 10 HTML 5 (continued) - The audio Element (continued)
2. 10 HTML 5 (continued) - The video Element - Prior to HTML 5, there was no standard way to play video clips while a document was being displayed - Video codecs are stored in containers - Video codecs: H. 264 (MPEG-4 AVC) – can be stored in an MPEG-4 container Theora – can be stored in any container VP 8—can be stored in any container - Different browsers support different codecs - The width and height attributes set the screen size - The autoplay attribute, set to "autoplay", specifies that the video should play as soon as it is ready - The preload attribute, set to "preload", specifies that the video should be loaded as soon as the document is loaded -The controls attribute, set to "controls", is like that of the audio element Chapter 2 © 2012 by Addison Wesley Longman, Inc. 39
2. 10 HTML 5 (continued) - The video Element (continued)
2. 10 HTML 5 (continued) - Organizational Elements - Header Elements - hgroup – a container for header information
2. 10 HTML 5 (continued) - The time Element - For putting a time stamp on a document - Two parts, text and machine-readable (datetime) - datetime attribute (optional) – the machine-readable part - Date part: 4 -digit year, a dash, 2 -digit month, a dash, 2 -digit day of the month (″ 2012 -08 -29”) - Time (optional) format: T 09: 00 - Text part is given as the content of time - The two parts need not specify the same date - Deficiencies: 1. Dates prior to the Christian era are not possible 2. No approximations Chapter 2 © 2012 by Addison Wesley Longman, Inc. 42
2. 11 Syntactic Differences between HTML & XHTML - Case sensitivity - Closing tags - Quoted attribute values - Explicit attribute values - id and name attributes - Element nesting Chapter 2 © 2012 by Addison Wesley Longman, Inc. 43





