Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

Similar presentations


Presentation on theme: "© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved."— Presentation transcript:

1 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
"Digital Media Primer" Yue-Ling Wong, Copyright (c)2016 by Pearson Education, Inc. All rights reserved. © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

2 Chapter 8 Introduction to HTML
Part 2 Basic Structure of an HTML Document © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

3 In this lecture, you will learn:
Basic structure of an HTML document What tags and attributes are XHTML vs. HTML © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

4 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Markup Tag Tells the Web browser the format of the text Surrounded by < and > Examples: paragraph tag: <p> © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

5 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Markup Tag In pairs: start tag and end tag (closing tag) Example: start tag: <p> end tag: </p> Placement of start and end tags Example: <p>This is a paragraph.</p> element content © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

6 Tags That Do Not Have Element Content
Examples: line break: <br></br> can be written as: <br /> image tag: <img></img> can be written as: <img /> © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

7 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Attributes of a Tag To specify properties of the element that is marked up the tag Example: id attribute: <p id="introduction">This is a paragraph.</p> Placed inside the start tag In name-value pairs like this: name = "value" © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

8 Basic Structure of an HTML Document
<html> <head> <title>This is a title.</title> </head> <body> This is the content of the Web page. </body> </html> © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

9 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
<html> tag First tag in an HTML document Tells the browser that this is the start of an HTML document End tag </html> is placed at the end of the HTML document © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

10 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
<head> tag Its element content is the header information <title> function definitions of JavaScript links to external JavaScript and style sheets Header information is not displayed in the body of the browser window © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

11 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
<title> Tag Its element content is the title of the document The title is displayed on the Window bar of the browser window The title is used as the bookmark for the page © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

12 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
<body> Tag Its element content is what will be displayed in the browser window © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

13 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Nested Tags Markup elements can be nested in another element (i.e., placed within another element’s content.) Example: header and body elements are nested inside <html> title element is nested inside <head> © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

14 End Tag Placement in Nested Tags
Similar to how parentheses are paired in a mathematical equation © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

15 Basic Structure of an XHTML Document
Same basic structure as an HTML document Plus a DOCTYPE declaration before <html> tag © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

16 Basic Structure of an XHTML Document
Example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " <html xmlns=" <head> <title>This is a title.</title> </head> <body> This is the content of the Web page. </body> </html> © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

17 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
DOCTYPE Declaration DOCTYPE stands for document type Uses the <!DOCTYPE> tag Placed in the very first line in the document Tells the browser which HTML or XHTML specification the document uses If the code used in the document does not match the DOCTYPE declared, then some of the elements may not be displayed as expected A Web page editor, such as Adobe Dreamweaver, usually inserts it for you © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

18 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
3 Document Types The XHTML 1.0 specifies three document types: Strict <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " Transitional <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " Frameset <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" " © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

19 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
XHTML vs. HTML XHTML elements must always be closed or paired Any start tag must be paired with an end tag XHTML tags and attributes must be in lowercase XHTML elements mus be properly nested within each other © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

20 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
XHTML vs. HTML An XHTML document must have one root element (i.e., the topmost element) <html> is the root element of an XHTML document The HTML element must designate the XHTML namespace, like this: <html xmlns=" "> xmlns is the namespace attribute There must be a DOCTYPE declaration in the document prior to the root element (i.e., <html>) © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

21 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Review Questions Note to instructor: Depending on your preference, you may want to go over the review questions at the end of this lecture as an instant review or at the beginning of next lecture to refresh students' memory of this lecture. © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

22 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Review Question ___ are markup codes in an HTML document that tell the Web browser how to format the text when displaying it. Tags Attributes A © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

23 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Review Question ___ specify properties of the element that is marked up by the ___. Tags; attribute Attributes; tag B © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

24 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Review Question <p id="introduction">This is a paragraph.</p> In the example above, ___ is a tag and ___ is its attribute. <p>; id id; <p> A © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

25 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Review Question In the HTML code: <p>This is a paragraph.</p> <p> is the __, and </p> is the ___. The text "This is a paragraph." is the ___. element content; start tag; end tag element content; end tag; start tag start tag; end tag; element content start tag; element content; end tag end tag; start tag; element content end tag; element content; start tag C © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

26 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Review Question Fill in the correct start tags and end tags to create a basic HTML document. <___> <___>This is a title.<___> This is the content of the Web page. <html> <head> <title>This is a title.</title> </head> <body> This is the content of the Web page. </body> </html> © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

27 © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Review Question Describe briefly how XHTML is different from HTML in terms of each of the following: Tag pairing Cases of tags Tag nesting Root element of a page DOCTYPE declaration i. Any start tag must be paired with an end tag ii. Lowercase iii. Nested tags be properly closed (similar to how parentheses are paired in a math equation) iv. Must have one root, <html> v. Must have a DOCTYPE declaration in before the root element, i.e. in the first line before <html> tag © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.


Download ppt "© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved."

Similar presentations


Ads by Google