Professional Documents
Culture Documents
C H A P T E R
h eG s Tag
Links as Buttons Franes, der&tme
L t i gW e b P a
ages
esides that, yo9
uau learntaboutvarioustypes of listtags u6d in HTMI and their properties,
class you
l
This chapter explains some more essertial elemerds f
an
jous
a t e
p r e v i
oresent data
present in a tabular fornat,
how to
M L p a g e
died
I k em a g e
Images,
Anchohorelement, Links,Frarnes,
e like
INSERTING IMAGES
aN
in our vweh pages, Besides tep, you
allowusto incude variousgraphical elements
edia features te
M I ' sm u l t i m e d i a
or photographs on
web page, edements a
These make
b browsers
h e web
support
t e r n e t .
he
fomats
External images, The inline image is displayed when the web page
two types
mages:Inline and
of ima with other
Thereare the external image is not displayed automatically
inserte within a line of text,
is inserted
whereas
andis
and viewed separately by dicking on alink
referenced externally and
opened
web page.
Instead, itis
cOntento onthe
IMG> TAG
THE attributes to be
89 is an empty tag and requires different
u s e dtoadd imagesin
an HTML webpage, It fiow
is used
tagis
nd>tag browser how to layout the page
so that the text can
img> tell the
The for the <img tag
cified with it. Theseattributes
pecih
the image.
properlyaround
SOURCE OFAN IMAGE
DEFINING THE the src attribute is
used.
image on a web page,
source of an
fo add and definethe file"
src="Address or path of the image where the file is stored.
Let uS
SYNTAX: <img well aware of its location, í.e.,
one should be
While specifying theimage file,
we can refer
the following examples: HTMLfile exists, then
understand it with where the referring
the same folder
"pic1.jpg" lies in
Example1:Iftheimage file,
file by simply writing its namne.
tothe image
then we referte
<img src= "pic1.jpg">
in which HTML file exists,
other than the one
file "pic1.jpg" lies in a directory
Example2: If theimage of the file:
specifying the full path
theimage by
cimgsrc="C:|Users|KIPS|Pictureslpic1.jpg"> folder of the we
rather it exists in
the 'images'
not lie in your computer,
"pic1.jpg" does
dnple 3: If theimage file full of the file:
path
then we need to give
serverofGoogle,
c i m g s r c - " h t t p : / / w w w . g o o g l e . c o m / i m a g e s / p i c 1 . j p g "
SPECIFYING HEIGHT AND
The HEIGHT WIDTH FOR AN IMAGE
attribute specifes the pixels) of an image either in the form of an integ or a percent
The WIDTH attribute height
value. specifies the width (in pixels) of
pixeis an image either in
the form of an
integer or tagevalue,
<htmls
ercentag
<head>
ctitles height and D heght and wdth
width </title>
<body> </head> C00
fle//C/Users/Dineshs20ThakurfDesktop/cas he
H Aps For auidkacies gace your bookmais en on te booems b fnpot on
Kimg src=
p>
"camel.jpg" style= height: 70%; width: 50%>
Morphing is special effect in
a
ALIGNING IMAGE
To align an image to the right or left
of the text, use the CSS
Example: <p>cimg src="
property-float.
imagl.jpg" style =
The image will float:right;width:50px;height:50px>
appear to the right of the text.
</p>
TIP
To align an image to top, bottom, or
middle, use the CSS property
vertical-align.
NOTE
In
previous versions of HTML, align attribute was
used to align the
images to left or right of the text.
ALTATTRIBUTE
The ALT attribute
displays text as an alternative to the
display images due to some reasons image. Sometimes a browser on the
(maybe because of slow
user's computer da
you can display the text to
describe the image. The connection or error in the
NOTE spaces
fo the ALT attribute is a text string of up to 1024 character
The valuefor enclosed in quotation marks including
or otherpunctuation.
<htmls
<head>
height:150px> </p>
</body>
</htmls
title>Creating a Table</title>
Facilities in a school
<style type="text/css"'s
body{background-color:RGB(255,251,214)}
table,td,th{border:1px solid green ALibrary
BigPlayground
tablelborder-collapse:separate;
tdtext-align:center
A School
s/styles
roMpu
sheads
<body> AComputer Lab A Music Room
<center><tables
<caption><hl>Facilities in a schoole/h1>«/caption
Playgroundeh5
upctd cimg src="playground.jpg" stylewwidth:100%><h3 Big
ctdscimg srce "library.jpg" style=width:1003> <h3>A Library</h3»<jtd2s1
tpetd colspans2>cimg srca"school.ipg" style=width:100%>ch3oA Schoolnh3>4/to
</tr>
<tr
ctdbcimg src="complab.jpg" style=width:100%><h3>AComputer Labejn 971
TYPES OF LINKING
Internal Linking
External Linking
Internal linking: When one part of a web page is linked to another section on the same page, it is calledinterna
linking.
it is called external linking
External linking: When one page is linked to another web page or website,
REF ATTRIBUTE
REF is an attribute of <A> anchor tag, which defines the document to which the link leads.
Learning
Camputers wit Kips 146
e w r diapla
etondened adcoioed
e fsloeg codeand saveie fle oe tie sae,dii
afetypetaioa
wofikgoHOODORT5,T5,24
ae
hesd
THOHTOR THEDAI n p
gtfestetalgrijusnty
Lschnew
dayisanew
in there PS TEA
dhalerge,1otayfresh and alive sprt,
mstbe change,Findnew tactiks,methods, COD HELP THOSEWOHELPTHEELES
andmodesof operationthatarerigtfor
MWbeleft
toda/'ssituation,otherWse You
behindandeventually tbe forgotten.clp
do KIPSTEAM <bo dp
pstyletextaligpurightpolorred
Rermermber: <br
pstyle-textalignucenterpolortlueAlways
4boGODHELPSTHOSE WHO HELPTHEMSELVESlb
4fbody
htmly
Now, type the name link.html.
with the
following PIO8ram
6 program code in a new file and save the file
<html>
<head> Hyperlinik Example
C O file:l/C/Users/Dineshs.20Thakur/Desk
stitle> Hyperlink Example
the bookmariks
For quick access place your
bookmaris here on bar inpo bo
Apps
s/title></head><body>>
<a href =
"click.html"> CLICK HERE </a> CLICK HERE
s/body>
</htmls
NOTE
Remember, if the linked HTML document exists in folder, you must specify the complete path and the
a different
<htmls
<head>
<title> The Link States </title>
<style type="text/css">
bodyftext-align:center;margin-top:50}
a:linkfcolor:red;text-decoration:overline
a:visitedfcolor:yellow}
a:hoverfcolor:purplej
a:activefcolor:green}
styles
heads
cbodys
Thisjsalink
Thg aink
http://channel.nationalgeographic.com"s
c ah r e f - " h t t
a link</h1>e/a>
ch1sThis is Hover
bodys</htmls Active
Visited
LINKS AS BUTTONS
linkS as buttons using CSS styling. The following example
demonstrates the same
e can also display
<htmis
chead>estyle type="text/css">
C file:///C/Users/Dinesh%20Thakur/Desk... e
text-align: center
bookemarks here on the bookmariks bar Import
bookmar..
text-decoration: none Apps Forquick access, placeyour
display: inline-block;}
IMAGES AS LINKSs
the following HTML code
Animage can also be used as a hyperlink to another document. Let us see an example, type
nthe file image.html:
DADCING INAGE LINK +
chead>
Types of Computer
ctitle>ADDING IMAGE LINK</title>
s/head>
MInieomputer Personal computer
<body> Mierocomputer
NOTE
HTML code written above, you must replace "Computer.jpg, and "Types of Lomputerpg'with
Note, that in the
name and path of the
images you have in your computer.
INSERTING AUDIO
HIMLS defines a new
tag, <audio> tag that specifies a standard way to insert an audio file in a web page.Itanbe
used for any file format like.mp3,.ogg, wav, etc.
The attributes of the <audio>
tag are given in the following table:
Attribute Purpose
src Specifies the URL of the audio file.
controls Displays the controls on the web page.
autoplay Plays the audio file automatically when the web page is loaded.
loop Replays the audio file.
The following example demonstrates some of the attributes of the <audio> tag:
chtml>
<head>
ctitle>Adding Audio Clip/title>
<style type"text/css">
ckeroundcolor RGB(250.214229))
esoes
hws
At
soleecolnbl
eblue> Music gives soul tothe
wings
to the nind, flight to the
mis
NUsers|User
serlDesktop Kalimba.mp3" 001/5 48
rbrowser
rdoes not support the audio tag.
udios bodys
h e m s
ASERTINGVIDEO
sertvideofles in our HTML pages with the help of the Video tag. Supported file formats include: .mp4,
insertvide
can
e and.ogg.A Attributes
ttrib associated with the <video> tag are given below:
Attribute Purpose
STC Specifies the URL of the video file.
controls Displays the controls on the web page.
autoplay Plays the audio file automatically when the web page is loaded.
CO fie/CUsens/Dines2othakur/ Deskt e
andp
dDA Video Cip hi>
idencantroissrc="C|Users|User|Desktoplvideo1.mp4"
wicth-720 heghe="540" autoplay
lnur browser does not support the video tag
ide
005/030
COTE
if the browser does not support <audio> and evideo>tags, then any text lying between
Let's Know More
You should alwep
<audios and <laudio> and will be displayed in
the browser as
pecify the
evide and </video> tags
video>
height ot anwidt and
dnd
Such
width and heightimae
specif the ars
FRAMES (icker while page w
We have seen so far that an HTML document takes up the entire size of a Drowser image.loading the
u t what if we want to display more than one HTML documents in a Drovw
a new HIML document embedded inside the current HTML document. The attributes
SRC
Let's Know More
With the help of this attribute, we specify the path of the document that should be
Before HTML5, audio
displayed in the inline frame. and video files could
only
be played in a browser
SYNTAX: <iframe src=value> with plug-in (like
a
HEIGHT& WIDTH
With these attributes we can control the size of the inline frames.
Let's Know More
SYNTAX: width=value in pixels
An iframe can be usedas
height=value in pixels the target frame for alink
Let us use the inline frames in our HTML document. by using the target
attribute of the link. The
First, create two files with the name, 'frame_a.html'and 'frame_b.html'. target attribute must
refer to the name
Now, type the below given code for the main document. attribute of the iframe.
For example:
<iframe
<html> src="testfile.html
name="iframe_1'></lifra
<head> me>
<a href="http://www.
<title>Main Document</title> google.com"target="ifra
me_1"> Google</a>
<style type="text/css ">
d-coloryellow
estyles
eheads
e
cbodys
ing fmes
document containing below given Th is the mals ders
h sThisis
nlineframes </h3s
FRAME A FRAMEB
a.htm/"
s r c eframe
trame
ht-200wid
width=200> </jiframe>
ciframes
src="frame_b.htn height=-200
width-200></liframes
body
htmls
o border-width:value
where value=thin, thick, medium, or a numeric value indicated in pixels.
border-style : value
where value can be none, hidden, dotted, dashed, solid, double, groove, ridge, inset, or outset
0 border-color: value
where value can be the name of the colour or its corresponding hexadecimal code.
Let us check out an example:
<html>
chead>
ctitle>Main Document</title>
style type="text/css">
body{background-color:yellow
iframefborder:10px dotted purple
cistyles
headbbodyo
ch> This is the main document
gven inline frameschas containing be e o
FRAMEA FRAMEBFRAME
width-200b-frame>
came src=rame
bhtm" height-200 width-200
sthyle-"border-width:5pxcborder-style:solid;border-
colorngreen>crames
came src="rame
chtm" height-200 width-200
style="bordernone">ciframe>
body
htmb
Recap Web browsers support various graphic formats but the widely used formats areCi
PNG, and JPEG formats.
GIF
There are two types of images: Inline and Extermal images.
T h e inline image is displayed when the web page is opened and is inserted within a line of text, whereas an
extemal image does not
get displayed automatically with other content on the web page.
Aninine image is inserted using the <img> tag, whereas, to insert an external image, the anchor tag <a> is
used that establishes a link to the
image.
o There are two types of linking: Internal linking and External linking
When of a web page is linked to another section on the same
one part
page, it is called Internal linking,
whereas, when one page is linked to another web page or website, it is called External
linking.
In HTML the anchor tag <A>, is used to mark the text as a hyperlink, which a user can click to display the web
page or website anchored to it.