340 likes | 799 Views
Lab of COMP 102 Mar . 14- Mar . 15 , 2012. The Head and Body Section. Shenghua ZHONG Department of Computing The Hong Kong Polytechnic University zsh696@gmail.com. Outline. The head Section The Supporting Elements in head Section The body Section List in body Phrase Elements in body
E N D
Lab of COMP 102Mar. 14-Mar. 15, 2012 The Head and Body Section Shenghua ZHONG Department of Computing The Hong Kong Polytechnic University zsh696@gmail.com
Outline The head Section The Supporting Elements in head Section The body Section List in body Phrase Elements in body Codes for Programming
Outline The head Section The Supporting Elements in head Section The body Section List in body Phrase Elements in body Codes for Programming
Beginning of head 4 • Characters of head • Is a section as well as an element • May contain any of the following elements as well: base, link, meta, script, style, and title • Nothing in the head section is displayed to users in the browser, except the <title> element, show in browser’s title bar • Example
Outline The head Section The Supporting Elements in head Section The body Section List in body Phrase Elements in body Codes for Programming
The Supporting Elements in head Section--<base> • Function of <base> • Help make links shorter and maintenance easier • Specify a base URL for all the links in a document • Required Attributes • href: Specifies a URL to be used as the base URL for links in the document • Example
The Supporting Elements in head Section--<link> • Function of <link> • Defines the relationship between two linked documents • Often used to link external style sheets into the current document • Optional Attributes • href: The URL pointing to the document that is being linked • rel: Defines the relationship between the document being linked to and the current document • type: Specifies the Multipurpose Internet Mail Extensions (MIME) type of the target URL • … • Example
The Supporting Elements in head Section--<meta> • Function of <meta> • Use the <meta> tag to provide keywords and descriptions that search engines can use to catalog your document • Optional Attributes • http-equiv: Connects the content attribute value to a specific HTTP response header • name: Assigns extra information to a document • … • Example
The Supporting Elements in head Section--<style> makes the screen font size 16 pixels, while making the text on the printed page 12 pixels. Both the screen and printed media have normal font weight (as opposed to bold) • Function of <style> • Create internal style sheets for your document. • Required Attributes • type: Defines the style type and is pretty much always set to text/css • Optional Attributes • media: Defines what media the style should affect. • … • Example
Outline The head Section The Supporting Elements in head Section The body Section List in body Phrase Elements in body Codes for Programming
body Element in Html • Position of body • Come after the head element and must be closed before the closing </html> tag • Any content appearing outside the body element will make the document invalid • Empty body element
The Supporting Elements in body Section--<p> • Function of <p> • Marking each paragraph’s boundaries with a p element • The beginning of one paragraph is indicated by an opening <p> tag, and a closing </p> tag marks its end • Required Attributes • type: Defines the style type and is pretty much always set to text/css • Optional Attributes • media: Defines what media the style should affect. • … • Example
The Supporting Elements in body Section--<h1>, <h2>, <h3>,...,<h6> • Function of <h1>,<h2>,….<h6> • Act as titles to introduce a new section of content • Offers a range of six heading elements to indicate the relative importance of a heading or its rank in the document’s hierarchy • Organize your document as a simple outline, separated into specific topics or areas of interest, sorted from the top down in order of importance • Example
The Supporting Elements in body Section--<pre> • Function of <pre> • Define a block of preformatted text in which white space and line breaks should be preserved exactly as they appear in the markup • Useful for displaying computer code or poetry • Example
Outline The head Section The Supporting Elements in head Section The body Section List in body Phrase Elements in body Codes for Programming
List in body • Three types of lists • Unordered lists, ordered lists, and definition lists In this lab, we introduce the first two. • Unordered list • Designated by the ul element and is used for lists wherein the sequence isn’t especially significant • Each list item is in turn defined by li element, all contained by the surrounding <ul> and </ul> tags • Example
Ordered List • Definition • The ol element defines an ordered list, items are followed in a specific sequence • Example
Outline The head Section The Supporting Elements in head Section The body Section List in body Phrase Elements in body Codes for Programming
Phrase Elements in body • Function of phrase elements • Wrap around a short string of a few words to give it added meaning and formatting • em • Add emphasis to a word or phrase • Display in an italicized font in most visual web browsers • Screen-reading software used by visually impaired may read contents aloud with different vocal inflection • strong • The strong element adds strong emphasis to text • More importance than an em element can provide • Text in a strong element is displayed in a boldfaced font in graphical browsers, but may be emphasized differently by other devices
More Popular Tags • br • Creates a line break at a specific point make text to wrap to a new line (single self-closed tag with />) • hr • Creates a horizontal rule, a dividing line between sections of content (single self-closed tag with />)
Outline The head Section The Supporting Elements in head Section The body Section List in body Phrase Elements in body Codes for Programming
Programming Code in HTML • code • Be used to designate a portion of code • kbd • Defines text or commands that the user should enter • samp • Illustrates sample output of a program or script • var • Be used to designate a programming variable or argument
Other Supporting Elements in body Section • blockquote • Designates a long quotation, such as a passage from a book or a blurb from a review • address • Provide contact information for the person or organization responsible for the particular document • abbr … • cite … • q … • dfn …