Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science Department

Similar presentations


Presentation on theme: "Computer Science Department"— Presentation transcript:

1 Computer Science Department
HTML Basics Dr. Awad Khalil Computer Science Department AUC

2 Markup Languages SGML, the Standard Generalized Markup Language (1980), is a more powerful ancestor of XML. SGML is a text-based meta-language used to describe application languages. SGML is a text-based language that can be used to markup data – that is, add metadata – in a way which is self describing. Although SGML has many useful features, the complexity of SGML makes it extremely hard to use and learn. HTML, the HyperText Markup Language (1989), is one of the best known applications of SGML. HTML was defined to be a universal markup language for the display of information, and the linking of different pieces of information. The idea was that any HTML document (or web page) would be presentable in any application that was capable of understanding HTML (termed a web browser).

3 HTML HTML is the document formatting language used to design most Web pages. It is a simple, yet powerful, platform-independent document language. Originally developed by Tim Berners-Lee while at CERN but was standardized in November 1995. In early 2000, W3C produced XHTML 1.0 as a reformulation of HTML 4 in XML.

4 DHTML Consists of number of technologies freely available for download
Used for developing high-performance, Web-based applications Much of application’s work performed directly on client rather then on server or Internet Two versions Microsoft Netscape

5 HTML HTML Tags: HTML tags cover formatting, structural, and semantic markup of an HTML document. <HTML> <HEAD> <TITLE> <BODY> <A> <IMG> <B> <I> <HR> Good morning <B> Egypt </B> <HR WIDTH="200"> In 1989, <B><I>Tim Brayners</I></B> developed the first version of HTML <HTML> <HEAD> <TITLE>Page1</TITLE> </HEAD> <BODY> Good Morning, <B><I>Egypt</I></B> </BODY> </HTML>

6 HTML Document Structure

7 Main.html Program Output
1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- Fig. 4.1: main.html --> 6 <!-- Our first Web page --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Welcome</title> </head> 12 <body> <p>Welcome to XHTML!</p> </body> 16 </html> Main.html Program Output The text between the title tags appears as the title of the web page. Elements between the body tags of the html document appear in the body of the web page

8 HTML <HTML> <HEAD>
<TITLE>The Year 2000</TITLE> </HEAD> <BODY BGCOLOR=”YELLOW” TEXT=”BLUE” LINK=”MAROON” ALINK=”GREEN” VLINK=”BROWN”>  <!-- The Body tag attributes specify the color scheme, such as the background color of yellow. -->  <H1> The Millenium Approaches</H1>  <FONT SIZE=”+5”> <I>And You’re Invited!</I> </FONT>  <P>  <FONT COLOR=”PURPLE”>Please come to my <B>Celebration of the New Millenium BBQ & Poetry Reading</B> to be held on December 31st at 7:00 p.m. Anyone reading this page is invited; send me mail using the link below for more details.</FONT>  <HR> <A KHALIL</A><BR> © 1999, Awad KHALIL  </BODY> </HTML>

9 W3C The World Wide Web Consortium (W3C) was started in 1994, according to their web site ( “to lead the World Wide Web to its full potential by developing common protocols that promote its evolution and ensure its interoperability”. W3C produces recommendations which describe the basic building blocks of the web. HTML recommendation is the most famous contribution of W3C to the web. In 1998, W3C released recommendations for XML 1.0, XSLT, and XPath.

10 W3C XHTML Validation Service
Validating an XHTML document. (Courtesy of World Wide Web Consortium (W3C).)

11 W3C XHTML Validation Service
XHTML validation results. (Courtesy of World Wide Web Consortium (W3C).)

12 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- Fig. 4.4: header.html --> 6 <!-- XHTML headers > 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Headers</title> </head> 12 <body> 14 <h1>Level 1 Header</h1> <h2>Level 2 header</h2> <h3>Level 3 header</h3> <h4>Level 4 header</h4> <h5>Level 5 header</h5> <h6>Level 6 header</h6> 21 </body> 23 </html> Header.html Every XHTML document is required to have opening and closing html tags. The font size of the text between tags decreases as the header level increases.

13 Program Output Select a header based on the amount of emphasis you would like to give that text.

14 Text between strong tags will appear bold.
1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- links.html > 6 <!-- Introduction to hyperlinks --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Links</title> </head> 12 <body> 14 <h1>Here are my favorite sites</h1> 16 <p><strong>Click on a name to go to that page.</strong></p> 18 <p><a href = " 20 <p><a href = " Hall</a></p> 22 <p><a href = " 24 <p><a href = " Today</a></p> 26 </body> 28 </html> Links.html Text between strong tags will appear bold. Linking is accomplished in XHTML with the anchor (a) element. The text between the a tags is the anchor for the link. Elements placed between paragraph tags will be set apart from other elements on the page with a vertical line before and after it. The anchor links to the page that’s value is given by the href attribute.

15 Program Output Clicking on the “Deitel” link will open up the Deitel homepage in a new browser window.

16 Text between strong tags will appear bold.
1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!– favorite-songs.html > 6 <!-- Introduction to hyperlinks --> 7 8 <html xmlns = " <head> <title>Links</title> </head> 12 <body> 14 <h1>Here are my favorite singers</h1> 16 <p><strong>Click on a name to hear a song !!</strong></p> 18 <p><a href = “enta-omry.mp3">Om Kalthoum</a></p> 20 <p><a href = "asmar-ya-asmarani.mp3">Abdel Halim Hafez</a></p> 22 <p><a href = "dakhelik-ya-emmi.mp3">Fayrouz</a></p> 24 <p><a href = “zedini-eshkan.mp3">Kazem El Saher</a></p> 26 </body> 28 </html> songs.html Text between strong tags will appear bold. Linking is accomplished in XHTML with the anchor (a) element. The text between the a tags is the anchor for the link. Elements placed between paragraph tags will be set apart from other elements on the page with a vertical line before and after it. The anchor plays the song that’s value is given by the href attribute.

17 Text between strong tags will appear bold.
1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!– videonet.html > 6 <!-- Introduction to hyperlinks --> 7 8 <html xmlns = " <head> <title>Links</title> </head> 12 <body> 14 <h1>Here is your first lesson in networking</h1> 16 <p><strong>Just click to see the video !!</strong></p> 18 <p><a href = “03SCRN02.avi">How to connect?</a></p> 20 <h1>Here is your first lesson in Geography</h1> 22 <p><strong>Just click to see the video !!</strong></p> 24 <p><a href = “fox.avi">Earth !!</a></p> 26 </body> 28 </html> vidoenet.html Text between strong tags will appear bold. Linking is accomplished in XHTML with the anchor (a) element. The text between the a tags is the anchor for the link. Elements placed between paragraph tags will be set apart from other elements on the page with a vertical line before and after it. The anchor plays the video that’s value is given by the href attribute.

18 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- contact.html --> 6 <!-- Adding hyperlinks --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Contact Page </title> </head> 13 <body> 15 <p>My address is <a href = egyptone.com </a>. Click the address and your browser will open an message and address it to me.</p> 20 </body> 22 </html> Contact.html To create an link include “mailto:” before the address in the href attribute.

19 Program Output When a user clicks on an link, an message addressed to the value of the link will open up.

20 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- picture.html --> 6 <!-- Adding images with XHTML --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Welcome</title> </head> 12 <body> 14 <p><img src = "xmlhtp.jpg" height = "238" width = "183" alt = "XML How to Program book cover" /> <img src = "jhtp.jpg" height = "238" width = "183" alt = "Java How to Program book cover" /></p> </body> 20 </html> Picture.html The value of the src attribute of the image element is the location of the image file. The height and width attributes of the image element give the height and width of the image. The value of the alt attribute gives a description of the image. This description is displayed if the image cannot be displayed.

21 Program Output The second image could not be displayed properly, so the value of its alt attribute is displayed instead.

22 A line break will render an empty line on a web page.
1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- Fig. 4.8: nav.html > 6 <!-- Using images as link anchors --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Navigation Bar </title> </head> 13 <body> 15 <p> <a href = "links.html"> <img src = "buttons/links.jpg" width = "65" height = "50" alt = "Links Page" /></a><br /> 20 <a href = "list.html"> <img src = "buttons/list.jpg" width = "65" height = "50" alt = "List Example Page" /></a><br /> 24 <a href = "contact.html"> <img src = "buttons/contact.jpg" width = "65" height = "50" alt = "Contact Page" /></a><br /> 28 <a href = "header.html"> <img src = "buttons/header.jpg" width = "65" height = "50" alt = "Header Page" /></a><br /> 32 <a href = "table.html"> <img src = "buttons/table.jpg" width = "65" height = "50" alt = "Table Page" /></a><br /> Nav.html Placing an image element between anchor tags, creates an image that is an anchor for a link. A line break will render an empty line on a web page.

23 Nav.html Program Output
36 <a href = "form.html"> <img src = "buttons/form.jpg" width = "65" height = "50" alt = "Feedback Form" /></a><br /> </p> 41 </body> 43 </html> Nav.html Program Output Clicking on the image entitled “links” brings the user to the page on the right. Using an image as an anchor works exactly the same as using text.

24 The horizontal rule element renders a horizontal line on the web page.
1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- Fig. 4.9: contact2.html > 6 <!-- Inserting special characters --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Contact Page </title> </head> 13 <body> 15 <!-- Special characters are entered --> <!-- using the form &code; > <p>My address is <a href = </a>. Click on the address and your browser will automatically open an message and address it to my address.</p> 23 <hr /> <!-- Inserts a horizontal rule --> 25 <p>All information on this site is <strong>©</strong> Deitel <strong>&</strong> Associates, Inc </p> 28 <!-- Text can be struck out with a set of > <!-- <del>...</del> tags, it can be set in subscript --> <!-- with <sub>...</sub>, and it can be set into > <!-- superscript with <sup...</sup> > <p><del>You may download 3.14 x 10<sup>2</sup> characters worth of information from this site.</del> Only <sub>one</sub> download per hour is permitted.</p> Contact2.html The horizontal rule element renders a horizontal line on the web page. Special characters are denoted with an ampersand (&) and an abbreviation for that character. In this case, the special characters are ampersand and copyright.

25 Contact2.html Program Output
36 <p>Note: <strong>< ¼</strong> of the information presented here is updated daily.</p> 39 </body> 41 </html> Contact2.html Program Output Text placed between del tags is struck out.. Text placed between the sub tags is subscripted. Text placed between the sup tags is superscripted.

26 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- Fig. 4.10: links2.html > 6 <!-- Unordered list containing hyperlinks --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Links</title> </head> 12 <body> 14 <h1>Here are my favorite sites</h1> 16 <p><strong>Click on a name to go to that page.</strong></p> 18 <ul> <li><a href = " 21 <li><a href = " Hall </a></li> 24 <li><a href = " 26 <li><a href = " Today</a> </li> </ul> </body> 31 </html> Links2.html The entries in an unordered list must be included between the <ul> and </ul> tags. An entry in the list must be placed between the <li> and </li> tags.

27 Program Output Each entry in the list is rendered on its own line with a bullet before it.

28 By inserting a list as an entry in another list, lists can be nested.
1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " 4 5 <!-- Fig. 4.11: list.html > 6 <!-- Advanced Lists: nested and ordered --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Lists</title> </head> 12 <body> 14 <h1>The Best Features of the Internet</h1> 16 <ul> <li>You can meet new people from countries around the world.</li> <li>You have access to new media as it becomes public: 21 <!-- This starts a nested list, which uses a --> <!-- modified bullet. The list ends when you --> <!-- close the <ul> tag > <ul> <li>New games</li> <li>New applications 28 <!-- Another nested list --> <ol type = "I"> <li>For business</li> <li>For pleasure</li> </ol> <!-- Ends the double nested list --> </li> 35 List.html By inserting a list as an entry in another list, lists can be nested. Entries for an ordered list must be placed between the <ol> and </ol> tags.

29 Text placed between the em tags will be italicized.
<li>Around the clock news</li> <li>Search engines</li> <li>Shopping</li> <li>Programming 40 <ol type = "a"> <li>XML</li> <li>Java</li> <li>XHTML</li> <li>Scripts</li> <li>New languages</li> </ol> 48 </li> 50 </ul> <!-- Ends the first level nested list --> </li> 53 <li>Links</li> <li>Keeping in touch with old friends</li> <li>It is the technology of the future!</li> 57 </ul> <!-- Ends the primary unordered list --> 59 <h1>My 3 Favorite <em>CEOs</em></h1> 61 <!-- ol elements without a type attribute > <!-- have a numeric sequence type (i.e., 1, 2, ...) --> <ol> <li>Harvey Deitel</li> <li>Bill Gates</li> <li>Michael Dell</li> </ol> List.html The type attribute of the ordered list element allows you to select a sequence type to order the list. Text placed between the em tags will be italicized.

30 List.html Program Output
69 </body> 71 </html> List.html Program Output Nested lists are indented underneath the main list. Some sequence types available to order lists are roman numerals, letters and numbers.


Download ppt "Computer Science Department"

Similar presentations


Ads by Google