Creating A Basic Web Page
Creating A Basic Web Page
Linking
To make a hyper link we use “anchor” signified
by the tag <a></a>
Anchors: have attribues:
– href: the page or Internet Service you want to link to
– target: where to open the new page
• _top:
• _parent:
• _blank:
• _self:
• or name of frame
Example
<html>
<body bgcolor="#E6E6FA">
<h1>Hello world!</h1>
<p><a href="http://www.yahoo.com">Visit
Yahoo.com!</a></p>
</body>
</html>
Values for TARGET attribute
_blank: The user agent (i.e. Internet browser) should load the
designated document in a new, unnamed window.
_self: The user agent should load the document in the same
frame as the element that refers to this target.
_parent: The user agent should load the document into the
immediate FRAMESET parent of the current frame. This
value is equivalent to _self if the current frame has no parent.
_top: The user agent should load the document into the full,
original window (thus canceling all other frames).
Add Images
HTML Images - The <img> Tag and the
Src Attribute
– <img src="url" alt="some_text">
Add Images
HTML Images - The Alt Attribute
– <img src="smiley.gif" alt="Smiley face">
Add Images
HTML Images - Set Height and Width of an
Image
– <img src="smiley.gif" alt="Smiley face"
width="42" height="42">
Images
HTML <body> background Attribute
– <html>
<body background="bgimage.jpg">
<h1>Hello world!</h1>
<p><a href="http://www.facebook.com">Visit
Facebook!</a></p>
</body>
</html>
HTML Multimedia Tags
Add Audio
HTML Audio - Using <embed>
<embed height="50" width="100"
src="horse.mp3">
Problems:
Different browsers support different audio formats
If a browser does not support the file format, the audio will
not play without a plug-in
If the plug-in is not installed on the users' computer, the
audio will not play
Add Audio
HTML Audio - Using <object>
<object height="50" width="100"
data="horse.mp3"></object>
Problems:
Different browsers support different audio formats
If a browser does not support the file format, the audio will
not play without a plug-in
If the plug-in is not installed on the users' computer, the
audio will not play
Add Audio
HTML5 <audio> Element
<audio controls>
<source src="horse.mp3" type="audio/mpeg">
<source src="horse.ogg" type="audio/ogg">
Your browser does not support this audio format.
</audio>
Problems:
You must convert the audio files into different formats
The <audio> element does not work in older browsers
Add Audio
HTML Audio - The Best Solution using HTML 5
<audio controls>
<source src="horse.mp3" type="audio/mpeg">
<source src="horse.ogg" type="audio/ogg">
<embed height="50" width="100" src="horse.mp3">
</audio> Best Solution
Problems:
You must convert the audio files into different formats
The <embed> element cannot "fall-back" to display an error
message
Add Audio
HTML Audio - Using A Hyperlink
<a href="horse.mp3">Play the sound</a>
Add Video
HTML Video - Using <embed>
– <embed> tag defines a container for external
(non-HTML) content.
<embed src="intro.swf" height="200"
width="200">
Problems
If the browser does not support Flash, the video will not
play
iPad and iPhone do not support Flash videos
Add Video
HTML Video - Using <object>
– <object> tag tag can also define a container for
external (non-HTML) content..
<object data="intro.swf" height="200"
width="200"></object>
Problems:
If the browser does not support Flash, the video will not
play
iPad and iPhone do not support Flash videos
Add Video
HTML Video - The Best Solution
– HTML5 <video> element + the <embed> element.
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
<object data="movie.mp4" width="320" height="240">
<embed src="movie.swf" width="320" height="240">
</object>
</video>
Problems:
You must convert your videos to many different formats
Add Video
HTML Video - YouTube Solution
Add Video
HTML Video - Using A Hyperlink
– <a href="intro.swf">Play a video file</a>
Creating Lists
HTML supports two kinds of lists:
– an ordered list, which is used to display information in
a numeric order
– an unordered list, which list items are not listed in a
particular order i.e. bullets
table cells
two rows
two columns
table headings
table headings
right-aligned column
This cell
spans two this cell
columns and spans three
two rows columns
This cell
spans three
rows
HTML code
resulting table
Creating Web Pages with HTML, 3e 53
Prepared by: C. Hueckstaedt, Tutorial 4
Adding Spanning Cells to a
Table
this cell spans two
This figure shows a table with spanning cells.
columns
spanning cells
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option
value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
Selection Lists with
Different Size Values
<select size="3">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option> size = "1" size = "4"
</select>