Computer language - HTML tags

iumamaheswari 343 views 33 slides Nov 29, 2020
Slide 1
Slide 1 of 33
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33

About This Presentation

HTML tags, Tags, Empty tag, Container tag, Attributes, Structure of HTML document, Head section, body section, comment tags, Font tag, attribute of font tag, More tags on formatting, heading tags, paragraph tag, the paragraph attribute 'align', line break, horizontal tag, line break, backgro...


Slide Content

HTML Tags
By
Dr. I. Uma Maheswari
[email protected]

Tags
•Tagsalsocalledasmarkups,instructthe
browserhowtodisplayHTMLdocument.
•Itconsistsofakeyword(whichhaspre–
definedmeaning)enclosedwithin
angularbrackets(<>).
•HTMLusestwotypesoftagelement
1.Emptytag
2.Containertag

Empty tag
•Emptytagrepresentstheformatting
optionsoftextsuchaslinebreak,
horizontalruler,paragraphsettingetc.
•Thesetagshaveonlybeginningtag(start
tag)
•Eg.<BR>,<HR>,<P>

Container tag
•Containertagshaveasectionoftext,
whichspecifiestheformattingconstruction
foralltheselectedtext.
•ContainertaghasbothstarttagandEnd
tag.
•Theendtagissameasthestarttagwith
anadditionofaforwardslash.
•Eg<B>…………..</B>
<body>……..</body>

Attributes
•Attributesareadditionalinformationgiven
toatag.
•Theyareusedforspecificpurposeonly.
•Attributesareaddedonlyto‘start’tagsand
notto‘end’tags.
•Attributesarenotenclosedwithinangular
bracket.

Structure of HTML document
•HTML document has two sections
1.Head Section
2.Body Section
<HTML>
<HEAD>
Head section <TITLE> …………… </TITLE>
</HEAD>
<BODY>
Body section
</BODY>
</HTML>

Head section
•Containsalldocumentheaderinformationliketitle
ofthedocument.
•Thissectionbeginsandendswith<HEAD>…….
</HEAD>tags.
•Thedocumenttitleisdisplayedwiththehelpof
<title>…..</title>tagswhichisenclosedwithin
<head>……</head>tags.
•Thistitleisdisplayedinthetitlebaroratthetopof
thedocument.
•ItisaquickreferencetoWWWbrowsersandother
applicationthataccessHTMLfiles.

Eg.,1
<HTML>
<HEAD>
<TITLE> Computer Education </TITLE>
</HEAD>
</HTML>
Eg., 2
<HTML>
<HEAD>
<TITLE> Introduction to HTML </TITLE>
</HEAD>
</HTML>

Body Section
•Thebodysectioncomesafterhead
section.
•Itincludestext,object,imagesandsound
thatgetsdisplayedinthebrowserwindow.
•Thebodysectionisenclosedwith<body>
….</body>tags.

Comment tags
•Commentsareaddedtothedocumentsforthe
benefitofthewriter,whichhelpstounderstand
thedocument.
•Itisalsousedtospecifytheauthor’sname,copy
rightmessageetc.
•Commentsareincludedanywhereinthe
program.
•Thesecommentstatementsareignoredbythe
browser.
•Theyaregivenwithin<!--and-->tags
•eg.<!--Thisisatitleofthewebpage-->

Tags
•<BIG> ….. </BIG> -displays the text in a font
larger than the font currently being used.
•<small> …… </small> -displays the text in a
font smaller than the font currently being used.
Eg.<HTML>
<HEAD>
<TITLE> My first html coding </TITLE>
</HEAD>
<BODY>
<BIG> ELECTIVE </BIG>
<SMALL> COMPUTERS IN EDUCATION </SMALL>
</BODY>
</HTML>

<FONT>
•<font>tagisusedtospecifythefont
style,sizeandcolourforacharacter,
phraseorarangeortexttobe
displayed.
•<font>……..</font>tags,enclosesthe
text.

Attributes of font
FACE
•Fontstylesdisplayedinthebrowsercan
bechangedusingthefaceattribute.
•Faceattributehasavaluewhichisafont
name,enclosedwithindoublequotes.
•Ifthespecifiedfontisnotavailableinthe
system,thendefaultfontwillbeassumed.

Size
•Thesizeattributeisenclosedwithinthefonttag
thatindicatesthesizeinwhichthefonthastobe
displayed.
•Thevaluesofsizeattributesare1to7,where3
isthedefaultsize.
Colour
•Thisattributeisusedforchangingthecolourof
thetext.
•Thevalueofcolourattributeiseitheracolour
nameoraRGBcode(000000toFFFFFF).

Example
<HTML>
<HEAD>
<TITLE> My first html coding </TITLE>
</HEAD>
<BODY>
<FONT FACE = “ Arial” SIZE = “5” COLOR = “BLUE”>
ELECTIVE
</FONT>
<SMALL> COMPUTERS IN EDUCATION </SMALL>
</BODY>
</HTML>

More tags on formatting
Bold-The<B>tagisusedtodisplaythetextthicker
anddarkerthannormal.Theendtagis</B>
Italics-TodisplaythetextinItalics,<I>tagisused.
Theendtagis</I>
Underline-The<U>tagisusedtounderlinethetext
inthedocument.</U>istheendtag.
Center-Thetextenclosedwithin<center>…….
</center>tagwillbedisplayedinthecenterofthe
line.

Example
<HTML>
<HEAD>
<TITLE> My first html coding </TITLE>
</HEAD>
<BODY>
<FONT SIZE = “5””>
<B>ELECTIVE </B><BR>
<U>ELECTIVE </U><BR>
<I>ELECTIVE </I><BR>
<Center>ELECTIVE </Center><BR>
</FONT>
<SMALL> COMPUTERS IN EDUCATION </SMALL>
</BODY>
</HTML>

Heading tags
•There are six levels of headings from
heading 1 to heading 6 in HTML.
•The heading tags has a start tag and an
end tag.
•H1, H2, H3, H4, H5, H6 are the six levels,
each having its own appearance.
•The headings tags are used to set apart
document text and section subtitles.

Example
<HTML>
<HEAD>
<TITLE> My first html coding </TITLE>
</HEAD>
<BODY>
<H1>ELECTIVE </H1><BR>
<H2>ELECTIVE </H2><BR>
<H3>ELECTIVE </H3><BR>
<H4>ELECTIVE </H4><BR>
<H5>ELECTIVE </H5><BR>
<H6>ELECTIVE </H6><BR>
</BODY>
</HTML>

Paragraph
•Theparagraphtag<P>isusedtobreak
thetextintoparagraphs.
•The<P>tagisplacedatthebeginningof
eachnewparagraph,andthebrowser
separatesthetextintoparagraphs.
•Theendtag</P>isoptional.
•Theparagraphalignmentisalsopossible
inHTML

The paragraph attribute ‘align’
<P align = “left”> -aligns paragraphs to the
left
<P align = “right”> -aligns paragraphs to the
right
<P align = “center”> -aligns paragraphs to
the center
<P align = “justify”> -justifies the paragraphs
to the page

Example
<HTML>
<HEAD>
<TITLE>Myfirsthtmlcoding</TITLE>
</HEAD>
<BODY>
<Palign=“left”>TowriteaHTMLdocumentcodewe
needatexteditororawordprocessorwhichsavesthedocumentsin
plain,flat,unstyledASCIIstyletext.
<Palign=“right”>HTMLrequiresawebbrowserto
displaythedocument(webpage)createdusingtexteditor.
<Palign=“center”>TheBrowsersareMSInternet
Explorer,NetscapeNavigator,Mosaic,Netcruiser,MacWebetc.
<Palign=“justify”>TowriteaHTMLdocumentcodewe
needatexteditororawordprocessor
</BODY>
</HTML>

Line Break
•Thebrowsersnormallydisplaysthetextin
onelinethatareincludedinthebody
section.
•Thewhitespacesandcarriagereturnsthat
areusedinthetexteditorwillbeignored.
•Thedocumentthatmaybeperfectly
alignedinthehtmldocumentwillnotbe
alignedinthebrowserwhileitisdisplayed.
•Toavoidthislinebreakisneeded.

•The<BR>tagisusedtogivealinebreak.
•Thetextplacednexttoitwillbeforcedto
startfromtheleftmarginofthenextline
onthescreen.
•Thelinebreakelementdoesnotgiveany
blanklinesbetweenthetext.
•Multiple<BR>tagsallowmultipleline
breaks.
•Itdoesnothaveanendtag.

Example
<HTML>
<HEAD>
<TITLE>Myfirsthtmlcoding</TITLE>
</HEAD>
<BODY>
<H1>youcan</H1>
Doallthegoodyoucan,<BR>
Inalltheplacesyoucan,<BR>
Toallthepeopleyoucan.
</BODY>
</HTML>

Horizontal tag
•Todrawahorizontallinethe<HR>tagisused.
•Itdoesnothaveanendtag.
•<HR>tagautomaticallyintroducesahorizontal
linebreak.
•The<HR>taghastwoattributes“size”and
“noshade”.
•Thesizeattributeisusedtospecifythethickness
ofthelinewhichisintermsofnumbersand
enclosedwithindoublequotesandthenoshade
attributedisplaysthelineindarkgrey.

Example
<HTML>
<HEAD>
<TITLE>horizontallinecoding</TITLE>
</HEAD>
<BODY>
<H1>youcan</H1>
<HRsize=“3”>
<HRsize=“25”noshade>
</BODY>
</HTML>

Background colour
•Thebackgroundcolourofthepagecanbe
changedbyusingthe“bgcolor”attribute.
•Bgcolourisoneoftheattributeof<body>
tag.
•HtmlallowsspecifyingcoloursinRGB
colourcode(000000toFFFFFF).
•Thefirsttwodigitrepresentred,thenext
twogreencomponentandthelasttwo
representsbluecomponent.

•Somebrowserallowstheusertousethe
colournamedirectly.
•Theyallowustouseupto16colour
namessuchasaqua,black,blue,fuchsia,
green,grey,lime,maroon,navy,olive,
purple,red,silver,teal,whiteandyellow.
•Ifthebackgroundcolourisnotspecified,
thebrowserassumesdefaultcolour
specifiedwhileinstallation.
Eg.,<bodybgcolour=“RED”>…</body>

Text attribute
•Thetextattributeisanotherattributeof
<body>tag.
•Itisusedtospecifythecolourinwhichthe
texthastobedisplayedonthebrowser.
•Thecoloursusedinbackgroundcolour
canalsobeappliedinthisattribute.
Eg.,<bodytext=“yellow”bgcolor=“red”>
……….</body>

•Whenthecolourofthetextischanged
usingTEXTattributeof<body>tag,then
thechangeaffectsallthetext.
•Whenthecolourofthetextischanged
usingCOLORattributeof<FONT>tag,
thenthechangeaffectsonlythetextthat
areenclosedwithinthe<FONT>tag.

Marquee tag
•Thetextenclosedwithinthe<MARQUEE> and
</MARQUEE>tagmakesthetexttoscrollfrom
oneendofthewindowtotheotherend.
•BGCOLOR andDIRECTION arethetwo
attributesofMARQUEEtag.
•BGCOLOR specifiesthebackgroundcolourof
thepageandDIRECTIONspecifiesthedirection
towhichthetextshouldscroll.
•Left(or)right(or)upanddown(or)downandup
arethedirections
•<Marguee>tagworksonlyininternetexplorer

Example
<HTML>
<HEAD>
<TITLE>marqueecoding</TITLE>
</HEAD>
<BODY>
<MARQUEEDirection=“right”>
Wishyousuccessincomingyears
</MARQUEE>
</BODY>
</HTML>