HTMLIntroduction
WhatisHTML?
HTMListhestandardmarkuplanguageforcreatingWebpages.
HTMLstandsforHyperTextMarkupLanguage
HTMLdescribesthestructureofWebpagesusingmarkup
HTMLelementsarethebuildingblocksofHTMLpages
HTMLelementsarerepresentedbytags
HTMLtagslabelpiecesofcontentsuchas"heading","paragraph","table",andsoon
BrowsersdonotdisplaytheHTMLtags,butusethemtorenderthecontentofthepage
ASimpleHTMLDocument
Example
<!DOCTYPEhtml>
<html>
<head>
<title>PageTitle</title>
</head>
<body>
<h1>MyFirstHeading</h1>
<p>Myfirstparagraph.</p>
</body>
</html>
ExampleExplained
The<!DOCTYPEhtml>declarationdefinesthisdocumenttobeHTML5
The<html>elementistherootelementofanHTMLpage
The<head>elementcontainsmetainformationaboutthedocument
The<title>elementspecifiesatitleforthedocument
The<body>elementcontainsthevisiblepagecontent
The<h1>elementdefinesalargeheading
The<p>elementdefinesaparagraph
HTMLTags
HTMLtagsareelementnamessurroundedbyanglebrackets:
<tagname>contentgoeshere...</tagname>
HTMLtagsnormallycomeinpairslike<p>and</p>
Thefirsttaginapairisthestarttag,thesecondtagistheendtag
Theendtagiswrittenlikethestarttag,butwithaforwardslashinsertedbeforethetagname
Tip:Thestarttagisalsocalledtheopeningtag,andtheendtagtheclosingtag.
WebBrowsers
Thepurposeofawebbrowser(Chrome,IE,Firefox,Safari)istoreadHTMLdocumentsand displaythem.
ThebrowserdoesnotdisplaytheHTMLtags,butusesthemtodeterminehowtodisplaythe document:
ViewinBrowser
HTMLPageStructure
BelowisavisualizationofanHTMLpagestructure:
<html>
<head>
<title>Pagetitle</title>
</head>
<body>
<h1>Thisisaheading</h1>
<p>Thisisaparagraph.</p>
<p>Thisisanotherparagraph.</p>
</body>
</html>
Note:Onlythecontentinsidethe<body>section(thewhiteareaabove)isdisplayedina browser.
The<!DOCTYPE>Declaration
The<!DOCTYPE>declarationrepresentsthedocumenttype,andhelpsbrowserstodisplayweb pagescorrectly.
Itmustonlyappearonce,atthetopofthepage(beforeanyHTMLtags).
The<!DOCTYPE>declarationisnotcasesensitive.
The<!DOCTYPE>declarationforHTMLis:
<!DOCTYPEhtml>
HTMLVersions
Sincetheearlydaysoftheweb,therehavebeenmanyversionsofHTML:
Version Year
HTML1991
HTML2.0 1995
HTML3.2 1997
HTML4.01 1999
XHTML 2000
HTML5 2014