HTML Notes Ngp
HTML Notes Ngp
HTML
Q. What is HTML ? State advantages and disadvantages of HTML .
Ans : -
HTML :-
HTML Stands for Hyper Text Markup Language.
It is used to create a World Wide Web document i.e., Web Page.
Hypertext is an ordinary text that has been dressed up with extra features
such as formattings , images , paragraphs , links and multimedia.
Markup is the process of converting ordinary text into Hypertext by adding
some extra symbol. This symbol is called as Tag < >.
Tag < > is the basic unit of markup.
HTML Web document is write on Editor such as Notepad and save with an
extension .html .
HTML page can be viewed on WEB BROWSER such as Google Chrome ,
Internt explorer , Mozilla Firefox , etc.
Advantages of HTML :-
For Creating HTML documents, Only text editor is needed. No special software is
required. For Ex. : In Windows Operating System , Notepad Editor is used to write
HTML Program.
HTML document can be created on any Hardware platform using any text editor.
Learning HTML is easy than any programming language.
If something is not working , then finding error is easy in HTML.
HTML will not cost anyrhing for its use. There are no expensive license to buy.
You will not rely on any vendor or any program for its use.
Contains powerful formatting facilities.
HTML pages can be easily updated without changing whole documents.
Disadvantages of HTML :-
HTML is not Programming language in True sense.Actually it is just Markup
language.
Any simple calculation can not be done in HTML.
1|Page
It can not be used to display even date and time.
The interactive web pages can not be built by using HTML.
The web pages developed in HTML cannot behave like an application.
The web pages developed in HTML do not have their own interface.
Hyperlink is provided in HTML. But for that we need a trip to server at each step.
<HTML> Tag :-
Every HTML document starts with Start tag <HTML> and end using </HTML> Tag.
<HTML> tag defines that the text follows defines an HTML web page and can be viewed in
2|Page
Web browser.All the remaining HTML program placed between <HTML> and </HTML>
tag.
<Head> Tag :-
<Head> Tag defines the header area of page , which will not display actual page
itself but just gives the information about that web page such as Title of Page,etc. <Head>
Tag begins Header section whereas </Head> tag ends Head section.<Title>….</Title > place
between <Head> and </Head> Tag.
<Title> tag :-
<Title> tag is paired tag. The text appear between <Title> and </Title> becomes title
of that web page and will be displayed on title bar of browser. Title of web page should be
descriptive as it is used for web indexing while searching the web page.
<BODY> Tag :-
The actual contents of the web page will be displayed in body section of web
page.The Body section starts with <BODY> atg and ends with </Body> tag.There are several
optional attributes of <Body> Tag such as bgcolor , background , link , alink , vlink , text ,
etc. Other tag which is used in displaying paragraph , image , text , multimedia are placed
between <Body> and </Body> Tag.
2. BACKGROUND :-
The BACKGROUND attribute of <Body> tag is used to put an image or wallpaper in
background of web page. The value of BACKGROUND attribute is source path of an
image where it stored in your computer.
3|Page
Ex. : <BODY Background=”C:/theme.jpg”>
3. TEXT :-
The Text attribute of <BODY> tag can set the text color of complete HTML page.
The value of TEXT attribute can be specify as Color name or can give six digit
hexadecimal RGB Code.
Ex. :- <BODY Text =” Red”> Welcome to Orange city </Body>
Now display the Output “ Welcome to Orange City “ in Red color.
4. LINK :-
It sets the color of all links in web page which are not visited yet by user.
Ex. :- < Body Link=”green”>
It sets the color of all unvisited to green colour.
5. VLINK :
It sets the color of all links in web page which have previously been visited yet by
user.
Ex. :- < Body VLink=”red”>
It sets the color of all visited to red colour.
6. ALINK :-
It sets the color of link which is currently active.
Ex. :- < Body ALink=”purple”>
It sets the color of link which is active to purple color.
4|Page
Tags in HTML :-
<P> Tag :-
<P> Tag is used to create the Paragraph.
A Paragraph can be created by enclosing text within <P> and </P> tag.
Browser will ignore the paragraphs created by pressing Enter key. You must
specifically define paragraph using <P> Tag.
< P> tag has one optional attribute . i.e., ALIGN. It is used to specify where
text appear on screen.
<P align =”left”> - Left alignment of Paragraph like normal text.
<P align=”right”> - Text aligned to right margin.
< P align=”center”> - Text is centrally align.
Ex. :- <P align=”left”> This is first paragraph . Its codes Continues over several
lines.
But displayed as a single paragraph In a browser. </P>
<BR> Tag :-
<BR> tag is used to put a line break.
<BR> tag is a singular tag means there is no end tag .
It tells the browser to wrap the text after <BR> tag onto new line.
A line break is just like typewriter carriage return- it takes you back to the left
margin.
Each <BR> tag will insert only one line.
Line inserted manually using ENTER K
Ex. :-
Mr. XYZ <BR>
25, Mahal ,
Kelibag Road <BR>
Nagpur- 440009
Will display O/P as :-
Mr. XYZ
25 , Mahal, Kelibag Road
Nagpur-440009
<HR> Tag :-
<HR> tag is Horizontal Rule tag . It is also called as horizontal line .
<HR> tag is a singular tag means there is no end tag .
5|Page
A web page can be divided into separate sections by using <HR> tag.
This tag is mostly used for decorative purposes.
<HR> tag has several optional attributes such as COLOR , SIZE , WIDTH ,
ALIGN ,etc.
One can change the color of Horizontal line using COLOR attribute .You can
also set the thickness of line using SIZE attribute , Value of SIZE attribute
should be mention in pixel. WIDTH attribute specifies span of line ,that value
either in Pixel or in %.
ALIGN attribute has 3 values LEFT , RIGHT and CENTER. The default value
is CENTER.
EX. :-
<HR COLOR=”Red” SIZE=”5” WIDTH=”60%” align=”Left”>
Above code will display horizontal line of red color with 5 pixel thickness and
span over 60% across browser’s window and start line from left margin.
6|Page
Output will be displayed as :
COMPUTER SCIENCE
COMPUTER SCIENCE
COMPUTER SCIENCE
COMPUTER SCIENCE
COMPUTER SCIENCE
COMPUTER SCIENCE
<B> Tag :-
<B> is bold tag .
<B> is a paired tag . <B> tag has end tag </B>.
The text appearing between start tag <B> and end tag </B> will be displayed
in Bold letter.
Ex. :- I like </B> Nagpur City </B> .
O/P :- I like Nagpur City .
<I> Tag :-
<I> is bold tag .
<I> is a paired tag . <I> tag has end tag </I>.
The text appearing between start tag <I> and end tag </I> will be displayed in
Itallics.
Ex. :- I like </I> Nagpur City </I> .
O/P :- I like Nagpur City .
<U> Tag :-
<U> is bold tag .
<U> is a paired tag . <U> tag has end tag </U>.
The text appearing between start tag <U> and end tag </U> will be
underlined.
Ex. :- I like </U> Nagpur City </U> .
O/P :- I like Nagpur City .
<PRE> Tag :-
<PRE> Tag is used to preformat the text. The text appearing between <PRE>
and </PRE> tag is displayed in monospace form.
This tag is used to position the character.
7|Page
This tag displays the text in exactly same format as given in source code of
HTML document .
Ex. :-
<PRE> Roll No Name Percentage
101 ABC 83.67 % </PRE>
In above example, The text format used in <PRE> tag will be display as it is .
.
<ADDRESS> Tag :-
<Address> tag displays web page information such as URL ( Web address ) ,
Author Name , Date of last revision ,etc and E-mail address initalics.
The text in <Address> tag is recognized by search engine as your address
information.
Ex. :-
E-mail Address : <address> [email protected]
The above code will be displayed as
E-mail address :
[email protected]
8|Page
What is <STRONG > tag ? Difference between <STRONG> and <B> tag .
<STRONG> is strong tag. The text appearing between start tag <STRONG>
and end tag </STRONG> will be displayed in Bold.
Like <B> tag ,<STRONG> tag also displayed text in BOLD but main
difference between <STRONG> and <B> tag is that text to speech browser
gives strident pronunciation to text within <STRONG> and </STRONG> tag
while no such emphasis given to text within <B> and </B> tag.
Ex. :-
You <STRONG> must </STRONG> crack this exam.
O/P :- You must crack this exam.
Nagpur
Pune
Akola
9|Page
In above example , each list item is preceded by Disc bullet . To change bullet type
we can use TYPE attribute of <UL> tag.
Will be displayed as
iv India
ix US
x China
</DL>
10 | P a g e
Output of above code will be displayed as :
Monitor
Monitor is an Output device
Mouse
Mouse is an Input Device
<A> Tag :-
In this Example , First Page enclosed within <A> and </A> tag becomes
hyperlink. It is clickable word. After cick on it it will redirect you to the URL of
web page given in HREF attribute of <A> tag i.e., Page 1.html.
<Font> is font tag. It is used to change the Color , size and type of the font .
<FONT> tag has 3 different optional attribute which can change the behavior
of the text enclosed between <Font> and </Font> tag.
COLOR , SIZE AND FACE are the attributes of <FONT> tag.
The SIZE attribute can be specified in absolute or relative values ranging from
1 to 7.SIZE=”7” is the largest size and SIZE=”1” is lowest size. You can also
specified size in relative by putting a plus or minus sign before the number
will change the font size relative to the current size of text.
For Example :
Absolute : <Font Size=”5”>
Relative : <Font Size=”+2”>
Value of COLOR attribute of <FONT> tag can be specified as color name or
you may also specify six digit RGB Code.
The FACE attribute specifies typeface that you would like to use for the text.
<BIG> Tag :-
In above example , Current size of Font is 3. <BIG> tag applied over Nagpur will
<SMALL> Tag :-
12 | P a g e
The text enclosed within <SMALL> and </SMALL> is displayed in smaller
font than current font size.
<SMALL> tag has same effect as <Font size=”-1”>
If the Current size of Font is smallest then <SMALL> tag will be ignored.
In above example , Current size of Font is 3. <SMALL> tag applied over City will
<STRIKE> tag :-
<MARQUEE> Tag :-
This is Marquee tag used to scrolling the text and image on screen.
The text written between <Marquee> and </Marquee> tag will scroll on screen in
horizontal line.
There are several attributes of <Marquee> tag i.e., BGCOLOR ,
BEHAVIOR,DIRECTION,HEIGHT and WIDTH
This is used to scroll the news or position of companies in stock market.
In above example the text “Orange City “ would scroll horizontally across screen.
<LI> Tag :-
13 | P a g e
<LI> tag can be used inside <UL> and <OL> tag to show unordered and ordered list
item.
Ex. :- <UL>
<LI> Nagpur</LI>
<LI> Pune </LI>
<LI> Akola </LI>
</UL>
Nagpur
Pune
Akola
In HTML , Hyperlink can be created by using <A> Anchor tag. Any text or image
enclosed between <A> and </A> tag would become Hyperlink. Hyperlink displayed by
browser in different color and underlined. Hyperlink is clickable word .On clicking Hyperlink
it would redirect to some other web page whose address is in HREF attribute of <A> tag.
<IMG> tag :-
14 | P a g e
It occur in the middle of line of text. If the image is larger one , then
line becomes very tall.
ii) Floating image :-
It cause text to wrap around an image. The paragraph will flow around
image for several lines.if image is large.
Generally, SRC and ALT attribute are always used with <IMG> tag. SRC
attribute specifies the path of an image file. For any browser that is not
displaying an images , the alternate text in ALT attribute is displayed instead
of an image.
For Inline image , ALIGN attribute of <IMG> tag has three attribute values
TOP , MIDDLE , BOTTOM.
For Floating image , there are two attribute values which are LEFT and
RIGHT.
To adjust the SIZE of an image there are two attributes HEIGHT and WIDTH.
BORDER attribute will displays Border around an image.
Above code will insert an image named as Mickey.jpg with border around it has
height is 300 pixel and width is 400 pixel.
With table, you can present data organized in rows and columns.
Table can be created in HTML using <TABLE> and </TABLE> tag.
Table consists of rows and columns.
The rows are first created using <TR> tag and then cells are inserted from Left
to Right.
Cell can consists of Table Heading or Table Data.
Table Heading can be inserted in cell using <TH> and </TH> Tag.
Table Data can be inserted in cell using <TD> and </TD> tag.
<Table> tag has several optional attributes :
BORDER : BORDER attribute is used to draw an outline around table.By
Default, Table has no border.
Cellpadding :- Decides the spacing between Cell Content and Cell Border.
Width :- Define how wide your table will appear across width of
15 | P a g e
Align : Decide the alignment of Table . Default table
alignment is Left.
<CAPTION> Tag :-
<Caption> tag is Paired tag , used to give caption or title to Table either on top
or below the table.
Caption of Table must be enclosed between <Caption> and </Caption> Tag.
<CAPTION> Tag has one attribute i.e., ALIGN which has two values TOP
and Bottom.
Caption always displayed outside the table’s Border.
<TR> Tag :-
<TR> is Table row tag.It is used to insert one row in a Table.
Row in a table starts with Start Tag <TR> and ends with </TR>
Table row must consist of atleast one Table Heading or one Table data.
Attribute of <TR> tag are BGCOLOR , ALIGN and VALIGN.
ALIGN : This attribute specifies the horizontal alignment of
row.Value of ALIGN attribute is LEFT , RIGHT and CENTER.Default
alignment is Left.
<TH> Tag :-
<TH> is table heading tag.The Start tag is <TH> and End tag is </TH>
This tag is used to represent individual column heading of a table.
By Default text in this cell is Bold and Centered.
It has ALIGN , VALIGN and BGCOLOR attributes.
Rowspan and colspan are the special attribute used with <TH> tag.These attributes
used merge the cell with another cell.
<TD> Tag :-
<TD> is table data tag. The start tag is <TD> and End tag is </TD>
<TD> Tag is used to insert table data in each individual cell.
The number of cells in a rows determines number of columns .
By Default, Table Data in a cell is aligned left horizontally and centered vertically.
16 | P a g e
It has ALIGN , VALIGN and BGCOLOR attributes.
Rowspan and colspan are the special attribute used with <TH> tag.These attributes
used merge the cell with another cell.
17 | P a g e