Web Design-Lecture 4-HTML
Web Design-Lecture 4-HTML
Hoshang Qasim
E-mail: [email protected]
2021
Comment Tag
• The comment tag is used to insert comments in the source code. Comments are not displayed in
browsers.
• You can use comments to explain your code, which can help you when you edit the source code a
later date. This is especially useful if you have a lot of code.
2 Note The commented code will not be visible to a webpage, and hence you can use
comment tag for documentation purpose, and debugging purpose:
Frames
3
Frames
• With frames, we can display more than one web page in the same browser
window
4
Frames
<html>
<title>Frameset page</title>
<frameset cols="25%,50%,25%">
<frame src="green.html">
<frame src="red.html">
<frame src="yellow.html">
</frameset>
</html>
5
Save this page by name yellow.html
Frames
<html>
<title>Frameset page</title>
<frameset rows="25%,50%,25%">
<frame src="green.html">
<frame src="red.html">
<frame src="yellow.html">
</frameset>
</html>
6
Frames
<html>
<title>Frameset page</title>
<frameset rows="50%,50%">
<frame src="green.html">
<frameset cols="25%,75%">
<frame src="red.html">
<frame src="yellow.html">
</frameset>
</frameset>
</html>
Iframe Syntax
• An HTML iframe is defined with the <iframe> tag:
<iframe src="URL"></iframe>
8
Iframes
first.html home.html
<!DOCTYPE html>
<html>
<body bgcolor="silver">
<iframe src=“first.html" height="200"
width="300"></iframe>
<iframe src=“home.html" height="200"
width="500"></iframe></body>
</html>
9
Image, Audio, and
Video
10
Adding images using <img> Element
• In addition to carrying all the universal attributes, the <img> element can carry the
following attributes:
Src, alt, height, and width
Src attribute
11 • The src attribute tells the browser where to find the image
Adding images using <img> Element
• specify the height and width of the image, and the values for these attributes are almost
always shown in pixels.
• helps a page to load faster and more smoothly because the browser knows how much space to
allocate to the image, and it can correctly render the rest of the page while the
image is still loading .
12
Image
<html>
<img src="image.png">
</html>
<html>
<img src=“folder/image.png">
</html>
13
Adding images using <img> Element
• To turn an image into a link simply place an image inside the <a> tag
• Images are often used to create graphical buttons or links to other pages.
<a href="http://www.wrox.com">
<img src="images/wrox_logo.gif" alt="Wrox logo" width="338" height ="79" >
</a>
14
keeping File Sizes Small
• Save the images in the formats that best compresses the image.(smaller file size) so:
• For complex photographic images Use smaller versions of the images when the pages first
load and then add a link to the larger version.
adding YouTube Movies to Your web pages
• By using <iframe>, or inline frame, is a special element that enables you to embed another
web page within a web page using the familiar src attribute
• Write click on the YouTube video and select the copy embed code.
• Then past the code in the HTML file that you would like to contain YouTube video
Poster
• The poster attribute specifies an image to be shown while the video is downloading, or
until the user hits the play button.
• If this is not included, the first frame of the video will be used instead.
• indicates whether the video should automatically play when the page is loaded.
loop
• as the name implies, indicates that the browser should start the video over when playback is
complete
muted
• indicates whether the video player should play the associated audio track.
poster attribute
• The poster attribute defines an image used as a placeholder until the video plays. If there is no
poster attribute defined, the first frame of the video is used as the poster
controls Attribute
• The controls attribute indicates whether the browser should include playback controls.
• the <audio> element works the same way as the <video> element
• an <audio> element and an src attribute are enough to get audio onto your pages.
<audio src="audio/pink_noise.mp3">
22
FINE-TUNING YOUT TEXT
The <span> element
• Generic element with no semantic value that you can use to group inline elements
• The <span> tag provides no visual change by itself.
24
The <strong> element
• Intended to show strong emphasis for its content. Stronger emphasis than the <em> element
• Most visual browsers display the strong emphasis in a bold font.
<p><em>Always</em> look at burning magnesium through protective colored glass as it <strong>
can cause blindness</strong>.
</p>
• Anything that appears in a <b> element displays in bold, like the word “bold” here:
25
The content of an <i> element displays in italicized text, like the word “italic” here:
The following word uses an <i>italic</i> typeface.
Elements Description
<small> defines smaller text, copyrights are typical usages of the <small> element.
<small id="copyright">© Rob Larsen 2012</small>
<cite> indicate the source of the quoted text. by default the content renders in italicized text,
This chapter is taken from <cite>Beginning Web Development</cite>
<code> Represent the programming code in the webpages. Usually using monospaced font
<p><code><h1>This is a primary heading</h1></code></p>
<sup> Subscript text appears half a character below the normal line. Sometimes rendered in a smaller font.
Written on the 31<sup>st</sup> February.
Subscript text can be used for chemical formulas, like H2O.
<sub> The <sup> tag defines superscript text. appears half a character above the normal line helpful to
create footnotes. The EPR paradox<sub>2</sub> was devised by Einstein, Podolsky, and Rosen.
26