IntroHTML Part1
IntroHTML Part1
IntroHTML Part1
Programming
Intro to HTML5
part 1
John Barr
Course Topics
• Review of HTML5
• Review of Web Site design
• Review of Cascading Style Sheets (CSS)
• DHTML using JavaScript and jquery
• Server-side processing using PHP and cgi
• Database using mysql
Course Topics
• Review of HTML5
• Review of Web Site design
• Review of Cascading Style Sheets
• DHTML using JavaScript
• Server-side processing using Perl and cgi
What is HTML?
• HTML has a central role in
the Web
https://www.tutorialspoint.com/html5/
html5_tags.htm
HTML5 Attributes
• Elements may contain attributes
– used to set various properties of an element.
• Some attributes are defined globally and can
be used on any element,
• others are defined for specific elements only.
• All attributes have a name and a value
• Attributes defined in CSS
• Attributes may only be specified within start
tags and must never be used in end tags.
• attributes are case insensitive
• convention is to stick with lower case.
HTML5 structure
• New tags introduced in HTML5 for better
structure
<section>…</section>
</article>
<aside>...</aside>
<figure>...</figure>
<footer>...</footer>
</body>
</html>
HTML5 example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example 1</title>
</head>
<body>
<header role="banner">
<h1>HTML5 Document Structure Example</h1>
<p>This page should be tried in safari, chrome or
Mozila.</p>
</header>
<footer>
<p>Created by <a
href="mailto:[email protected]">John</a></p>
</footer>
</body>
</html>
Continued on next page
Main.html
2 <!DOCTYPE html>
4
5 <!-- Fig. 4.1: main.html -->
6 <!-- Our first Web page -->
7
8 <html >
9 <head>
10 <title>Internet and WWW How to Program -
Welcome</title> The text between the
11 </head> title tags appears as the
12 title of the web page.
13 <body>
14 <p>Welcome to HTML!</p>
15 </body> Elements between the body tags
16 </html> of the html document appear in
the body of the web page
1
2 <html>
3 <head>
4 <title>Internet and WWW How to Program -
Headers</title>
5 </head>
6
7 <body>
8
Every HTML document is
9 <h1>Level 1 Header</h1> required to have opening
10 <h2>Level 2 header</h2> and closing html tags.
11 <h3>Level 3 header</h3>
12 <h4>Level 4 header</h4>
13 <h5>Level 5 header</h5>
14 <h6>Level 6 header</h6> The font size of the text
between tags decreases as
15 the header level increases.
16 </body>
17 </html>
Select a header based on the
amount of emphasis you
would like to give that text.
Program Output
Links
2 <!DOCTYPE html >
4
5 <!-- Fig. 4.5: links.html -->
6 <!-- Introduction to hyperlinks -->
7
8 <html >
9 <head>
10 <title>Internet and WWW How to Program - Links</title>
11 </head> Text between strong
12 tags will appear bold.
13 <body>
14
15
Linking is accomplished
<h1>Here are my favorite sites</h1>
16 in HTML with the anchor
17 <p><strong>Click on a(a) element.
name to go to that page.</strong></p>
18
19 <p><a href = "http://www.deitel.com">Deitel</a></p>
The text between the a tags
20
21 <p><a href =
is the anchor for the link.
"http://www.prenhall.com">Prentice Hall</a></p>
22
23 <p><a href = "http://www.yahoo.com">Yahoo!</a></p>
The anchor links to the
24
page that’s value is given
25 <p><a href = "http://www.usatoday.com">USA Today</a></p>
Elements placed between paragraph by the href attribute.
26
27 </body> tags will be set apart from other
28 </html> elements on the page with a vertical
line before and after it.
Clicking on the “Deitel” link will open up the
Deitel homepage in a new browser window.
2 <!DOCTYPE html>
4
5 <!-- Fig. 4.6: contact.html -->
Contact.html
6 <!-- Adding email hyperlinks -->
7
8 <html>
9 <head>
10 <title>Internet and WWW How to Program - Contact
Page
11 </title>
12 </head>
13
14 <body>
15 To create an email link include
16 <p>My email address is “mailto:” before the email
17 address in the href attribute.
<a href = "mailto:[email protected]">
[email protected]
18 </a>. Click the address and your browser will open
an
19 email message and address it to me.</p>
20
21 </body>
22 </html>
When a user clicks on an email link,
an email message addressed to the
value of the link will open up.
Program Output
2 <!DOCTYPE html>
4
5 <!-- Fig. 4.7: picture.html -->
Picture.html
6 <!-- Adding images with XHTML -->
7
8 <html>
9 <head>
10 <title>Internet and WWW How to Program -
Welcome</title>
11 </head>
The value of the src attribute
12
of the image element is the
13 <body> location of the image file.
14
15 <p><img src = "xmlhtp.jpg" height = "238" width
= "183"
16 alt = "XML How to Program book cover" />
17 <img src = "jhtp.jpg" height = "238" width =
"183"
18 alt = "Java How to Program book cover"
/></p>
19 </body>
The height and width
20 </html>
attributes of the image
The value of the alt attribute
element give the height and
gives a description of the image.
width of the image.
This description is displayed if
the image cannot be displayed.
The second image could not be
displayed properly, so the value of
its alt attribute is displayed instead.
2 <!DOCTYPE html >
4
5
6
7
<!-- Fig. 4.8: nav.html -->
<!-- Using images as link anchors --> Nav.html
8 <html >
9 <head>
10 <title>Internet and WWW How to Program - Navigation Bar
11 </title>
12 </head>
13
14 <body>
15
16 <p>
Placing an image element between
17 <a href = "links.html"> anchor tags, creates an imagethat
18 is an anchor for a link.
<img src = "buttons/links.jpg" width = "65"
19 height = "50" alt = "Links Page" /></a><br />
20
21 <a href = "list.html">
22 <img src = "buttons/list.jpg" width = "65"
23 height = "50" alt = "List Example Page" /></a><br />
24
25 <a href = "contact.html">
26 <img src = "buttons/contact.jpg" width = "65"
27 height = "50" alt = "Contact Page" /></a><br />
28
29 <a href = "header.html">
30
A line break will
<img src = "buttons/header.jpg" width = "65"
render an
31 height = "50" alt = "Header Page" /></a><br />
32 empty line on a web page.
33 <a href = "table.html">
34 <img src = "buttons/table.jpg" width = "65"
35 height = "50" alt = "Table Page" /></a><br />
36
37 <a href = "form.html">
38
39
<img src = "buttons/form.jpg" width = "65"
Nav.html
height = "50" alt = "Feedback Form" /></a><br />
40 </p>
41
42 </body>
43 </html>
</body>
Contact2.html
41 </html>