HTML Notes Part-1
HTML Notes Part-1
HTML Notes Part-1
HTML Versions
From the W3C organization there are the following versions released.
Version Specification Release Date
1.0 N/A (HTML 1.0) 1993-dec/1994 bare bone
2.0 HTML 2.0 24-Nov-1995
3.2 W3C: HTML 3.2 14-Jan-1997
4.0 W3C: HTML 4.0 24-Apr-1998
4.1 W3C: HTML 4.1 24-Dec-1999
5.0 WHATWG 28-Oct-2014
5.1 W3C: HTML 5.1 Nov-2016
5.2 W3C: HTML 5.2 14-Dec-2017
HTML introduction
1. HTML was developed by “Tim-Berners-Lee”, released in 1993-
dec/94 and maintained by W3C Org.
GML ⇒ SGML ⇒ HTML
90 91 94
4. HTML is used to design "static web pages", static web pages that
always show the same information.
6. HTML is “client side tech”. That means the html code executes on
the client browser but not on the server.
8. HTML is used in all real time web sites today; html is the
only language available in the world for designing Web pages.
11. HTML is not a case sensitive language that means you can
write the html code in either uppercase or lower case.
14. HTML is an interpreter-based language. Browser interprets HTML
code.
Translators: converting high level code (human) into machine level
code (MP/OS) is called translation.
Who performs this operation are called translators.
Types: compiler, interpreter, assembler
interpreter it translates code line-by-line and executes line-by-line
(interpretation)
interpreter
html code ⇐=============⇒ machine code
(English) (Binary code)
Tag:
· A tag is a keyword, enclosed within "<" and ">" in HTML
language.
· It is a special kind of text placed between the left angular brace
and right angular brace(<tag_name>).
· Tag is a predefined program, program is instructions /
command to the browser.
· Tag is used to display some specific output in the web page.
· Browser did not identify the tag; it shows a blank page or it
prints as text.
· tags also represented as elements.
types of tags
2. unpaired tags
⇒ contains only open tag.
Syn: <tagname> or <tagname/>
ex: <br/> <img/> <input/> <hr> <link> <meta>
⇒ Unpaired tags also called as body-less tags
⇒self closed tags
Structure of HTML
As per W3C we have to follow the following structure to design web
pages (but it’s not comp).
<!DOCTYPE html>
<html lang=”en”>
<head>
</head>
<body>
</body>
</html>
Versioning section
This is providing information to the browser which version we
are using in the web page/program. So, browser is interpreting
code and producing output as per given specification.
Syn: <!DOCTYPE html version-url>
HTML4.0:
<!DOCTYPE html public "-//W3C//DTD HTML 3.0//EN"
"http://www.w3c.org/TR/html3/strict.dtd">
Comment lines
⇒ Comment lines are to provide some description about
our program.
⇒ Comments are not executed by browser.
Syn:
<!-- text -->
…
Note: inside the body section we can repeat any tag and no of
times.
p tag
> p stands for paragraph.
> this tag is used to display/print more lines of text (paragraph)
> its paired tag and block level.
Syn:
<p> text or info </p>
Note:
br tag
èbr stands for break line (enter key)
èit moves the cursor to the beginning of the next line.
èits un-paired
Syn: <br> or <br/>
Html entities
=> Entities nothing but Special characters or html operators
=> Special characters are used to perform some task or to print
some Symbols.
=> Special characters is a English word
Syn: &word;
ex: € ©
Html hexa-decimal codes, these codes are starts with #
Hexa-dec base 16 è 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
Syn: &#hex-code;
digits; digits;
😍 ⚔
Formatting tags
b tag or strong
> b stands for bold
> b & strong tags used to print text in bold format
> both are paired tags & inline tags
Syn:
<b> text </b>
<strong> text </strong>
I or em tag
>i stand for italic (inclined)
>i & em tags used to print text in italic format
>i is paired
Syn:
<i> text </i>
<em> text </em>
u tag
> u stands for underline
> u tag used to print text with underline (draws a line base of text)
> u is paired tag
Syn:
<u> text </u>
strikeout tag
> strikeout tag used to print text with line (draws a line middle of text)
>strikeout is paired tag
Syn:
<strike> text </strike>
superscript tag
>this tag used to display text top of upper line
> superscript is paired tag
Syn:
<sup> text </sup>
subscript tag
>this tag used to display text bottom of baseline
> subscript is paired tag
Syn:
<sub> text </sub>
All these tags are paired tags & inline tags
Span tag
>span tag used for small textual data, like as error message, mandatory
specification.
> also in continuity of text, if we want to highlight couple of word or letters using
css
>its paired tag, inline tag
Syn: <span> text </span>
pre tag
> pre stands for pre-formatting (alignment)
> pre tag is used to print data/text, how we typed in same format
> pre is paired tag, block level
Syn:
<pre> text </pre>
Label tag
> label tag used for displaying prompting text.
> its paired tag, inline tag
Syn: <label> text </label>
title tag
This tag is used to set the title for a webpage, meaning every webpage
has an individual title.
Web site => 10 web pages => 10 titles (1page : 1title)
its paired tag.
<title> is the sub tag of <head> tag.
Syn:
<title> text </title>
Link tag
🡺 Link tag used to set the favicon/logo for a webpage.
🡺 Also used to link with external files (css file, bootstrap file)
🡺 Unpaired tag.
🡺 <link> is the sub tag of <head> tag.
Syn: <link rel=”icon” href=”filename.ext”>
Relative => icon or stylesheet
Hyper reference => address of image/icon
HTML Attributes
⇒ Attribute is a special feature/setting of a tag.
⇒ every tag they have attributes 99%
⇒ An HTML attribute is a piece of markup language used to adjust the behavior or
display of an HTML element. For example, attributes can be used to change the
color, size, or functionality of HTML elements.
⇒ HTML Attribute is something that we use in the starting tag of HTML Elements
or HTML Tags which provides extra information about those HTML Elements or
HTML Tags.
Syn:
Types of attributes
⇒ general attributes
These attributes are common for most tags (99% of tags). These
attributes are used to adjust the behavior or display of an HTML
element, to provide extra information about those HTML Elements to
the browser, to control size of element, to change alignment of
element …
those attributes are:
class, id, name, style, align, action, href, src, target, width,
height, alt, title, min, max, step, maxlength, type, checked, selected,
value, readonly, placeholder, rel etc…
⇒ event attributes
An event is a notification that is triggered when something
changes in the browser.
With event attributes these events are directed to JavaScript
which then responds to the event.
These attributes are used to perform some logical operations.
logical operations we can perform by using JavaScript, these also called
dynamic attributes.
By using event attributes From Html page we can trigger JavaScript
code or we can call JavaScript functions
attributes are:
onclick, ondblclick, onfocus, onblur, onkeypress, onkeyup,
onkeydown, onsubmit, onchange, oninput, onreset, onselect,
onmousemove, onmouseout, onmouseover, onwheel, onload,
onsubmit, onchange etc…
🡺Optional attributes
Same as gen attribute, but there attributes are not comp
to specify
ex: lang, method, type, …
Images
🡺 "img" tag is used to display images on webpage.
🡺 in one web pages we can display any no.of images and any
type of images.
.jfif .svg .jpg .bmp .gif .tif .png .webp
🡺 its un-paired tag and its inline element
Syn:
<img attributes/>
Note:
It is strongly recommended to place all images in side
root folder (or) create sub folder with name images in
root folder
attributes:
src => to specify which img you want to display
width => width of image (pixel)
height => height of image (pixel)
title => it is used to specify tool tip. (whenever mouse pointer comes on top of
image)
alt => alternative text, if image not loaded in webpage/not display, we want to
display text message to user it called as alt
hyper links
> “a” tag stand for "anchor”
>"a" tag is used to create hyperlinks, hyperlinks are used to
move from one webpage to another webpage.
>whenever the user clicks on the hyperlink, it moves to the
specified page.
> source page and destination page sometime within the same
application or other application.
attributes:
href : hyper reference, used to specify the address of webpage or web site,
i.e whenever user clicks on this link, which page you want to open
url may be html page, server-side file, image, audio file, video, pdf file,
documents etc...
href=”url”
“https://www.abc.com/login.aspx”
“” 🡺self-calling
“.” 🡺 home page of web site/home dir of web application
“#id” 🡺for internal links
ol tag
>ol stands for "Ordered List".
>it is used to display the text(names, colors, team names, course name...) with
numbering.
>it supports 5 types numbering, those are 1, A, a, i, I. by default it displaying in
number.
>by using "ol" tag we can create ordered list
>ol is paired tag & block level element
li tag
> li stands for "list item"
> li is sub tag of ol tag
> li tag is used to print text/data in points wise
> li is paired tag & block level element
Syn:
<ol attributes>
<li> text </li>
<li> text </li>
<li> text </li>
...
</ol>
ol attributes:
type : which type numbering to display (Default is 1)
start : from where u want to start numbering (default is 1)
reversed : to displaying numbers in desc order
li attributes:
value : used for restarting numbering with specified value
ul tag
>ul stands for "Unordered List".
>it is used to display the list of items(names, colors, team names, course name...)
with bullets.
>It supports 3 types of bullets, those are dot, circle, square. by default, is dot.
>by using "ul" tag we can create unordered list items
> ul is paired tag
>"li" tag used for creating list items
Syn:
<ul type="dot/circle/square">
<li> text </li>
<li> text </li>
<li> text </li>
...
</ul>
dl tag
>dl stands for Definition list (since html5 description list)
>dl tag used for to display definitions/full forms (collection of definitions)
>its paired tag
> "dt" and "dd" are sub tags of "dl" tag
> "dt" stands for definition title, "dd" stands for definition data.
> dt & dd are paired
Syn:
<dl>
<dt>title/word</dt>
<dd>information</dd>
<dt>title/word</dt>
<dd>information</dd>
<dt>title/word</dt>
<dd>information</dd>
...
</dl>
fieldset tag
> this tag used for drawing a common border around elements/tags.
> its paired tag and block level
> we can draw any no of borders
Syn: <fieldset attributes>
<legend>text</legend>
Sub elements
</fieldtset>
attributes:
align : align of elements, it supports 3 alignments center, left, right
left is default align
border : style of line, thickness of line, color of line
width : width of box (size in % )
legend tag
>legend tag used for set title/heading for fieldset
>legend is sub tag of fieldset tag
>its paired tag
Syn:<legend attributes>Heading</legend>
attributes:
align :align of elements, it supports 3 alignments center, left, right
left is default align
color :
Div tag
> div is a container, means its grouping elements of html.
> inside the div tag we can place any content like normal text or
images.
> div tag is used to divide web pages as no.of subpages/parts,
each part is rep as div.
> for better maintained, effective design of web pages and
simplifying css code.
>its paired tag, and block level element
table tag
>table tag is used to display the data in form rows & cols in the web page.
> a table is a collection of rows, each row is a collection of cells/col/field.
> a table is represented as <table> tag, a row represented as <tr> tag, a
colheading is represented as <th> tag, data rep as <td> tag.
> table heading is represented as <caption> tag.
><thead> tag is rep of table head part, <tbody> tag is rep of table body part and
<tfoot> tag Is rep of table footer part.
NOte:
<th> and <td> are sub tags of <tr>
<tr> is sub tag of <table>
table attributes:
border : border of table (0 means no border, 1-n border req)
align : alignment of table
width : width of table (%)
...
th& td attributes:
colspan : specifies the no.of columns to merge/expend
rowspan : specifies the no.of rows to merge/expend
...