HTML
HTML
College
Chapter 4
HTML
Introduction:
HTML is a language use to create website. These websites can then be viewed by anyone
else connected to the Internet. It is easy to very easy to learn and understand the code of
HTML. In true sense HTML is not a programming language because of its limitation; but
it behaves like a programming language. HTML has its own syntax and rules to
communication.
Advantages of HTML:
1. No special software is required to create HTML document.
2. HTML document can be created on any hardware platform and Operating system.
3. Understanding of structure of HTML is simple and you know how your page will be
displayed.
4. Finding of error is very easy.
5. No Licenses and expenses to buy and upgrades.
6. Learning is simple than any other programming languages.
2| Mohammed Ayaz Khan Maulana Azad Jr. College
Disadvantages of HTML:
1. In true manner HTML is not a programming language.
2. It can display a date.
3. Can’t do simple calculation.
4. Can’t built interactive web pages.
5. The web page create in HTML can’t work as an application.
6. The web pages developed in HTML do not have their interface.
Study of Tags:
These are well defined symbol used in HTML having special meaning, start with less than
sign (<) and conclude with greater than (>) sign. Here we first study the basic tags of
HTML.
<HTML> Tag:
This tag is compulsory to use at the beginning of HTML. It starts with <HTML> and end
with </HTML>.
<HEAD> Tag:
It defines the header area of page, which is not displayed on the web browser. It starts with
<HEAD> and ends with </HEAD>.
<TITLE> Tag:
3| Mohammed Ayaz Khan Maulana Azad Jr. College
It is used for title of web page and display on the tile of web browser. It is used within head
tag. It starts with <title> and ends with </title>.
<BODY> Tag:
The actual contents witch display on the web browser enclosed by this tag. It starts with
<BODY> and ends with </BODY>.
Attributes:
Attributes are used with many tags that affect tag’s behavior. An attribute is a keyword
separated by a space within angle brackets.
For example: <body bgcolor=”yellow”> it means that background of web page is yellow.
So we can several colors and color code to change the color of webpage.
“The most important tags in HTML are tags that define headings, paragraphs and line
breaks. The best way to learn HTML is to work with examples. We have created a very
nice HTML editor for you. With this editor, you can edit the HTML source code if you
like, and click on a test button to view the result.”
Heading Tags:
Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading. <h6>
defines the smallest heading.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6>This is a heading</h6>
HTML headings
4| Mohammed Ayaz Khan Maulana Azad Jr. College
This is a heading
This is a heading
This is a heading
This is a heading
This is a heading
This is a heading
Paragraphs:
Paragraphs are defined with the <p> tag.
<p>This is a paragraph</p>
<p>This is another paragraph</p>
HTML automatically adds an extra blank line before and after a paragraph.
Don't Forget the Closing Tag
You might have noticed that paragraphs can be written without end tags </p>:
<p>This is a paragraph
<p>This is another paragraph
The example above will work in most browsers, but don't rely on it. Future version of
HTML will not allow you to skip ANY end tags.Closing all HTML elements with an end
tag is a future proof way of writing HTML. It also makes the code easier to understand
(read and browse) when you to mark both where an element starts and where it ends.
5| Mohammed Ayaz Khan Maulana Azad Jr. College
Line Breaks:
The <br> tag is used when you want to break a line, but don't want to start a new paragraph.
The <br> tag forces a line break wherever you place it.
<p>This <br> is a para<br>graph with line breaks</p>
Try it yourself
The <br> tag is an empty tag. It has no end tag like </br>, since a closing tag doesn't make
any sense.
<big> Defines big text <big> success key </big> success key
<em> Defines emphasized text <em> success key </em> success key
<i> Defines italic text <i> success key </i> success key
<u> Define as underline <u> success key </u> success key
<small> success key
<small> Defines small text success key
</small>
<strong> success key
<strong> Defines strong text success key
</strong>
<sub> Defines subscripted text H<sub> 2 </sub>O H2O
Defines superscripted
<sup> MC <sup> 2 </sup> MC2
text
6| Mohammed Ayaz Khan Maulana Azad Jr. College
Font Tag:
Font tag is used to format the size, typeface, and color of the text. It is used with three
different attributes. Size, Face, and Color.
For Example:
<Font size=”+2”> xyz <Font>
<Font face=”arial black”> xyz <Font>
<Font color=”red”> xyz <Font>
Creating List:
List Tag : <LI>
It is list tag used with ordered and unordered list, ordered list are numbered fashion, while
unordered list are bulleted.
Ordered List: <OL> Tag
Ordered list can be start with English numerals, Roman numerals (upper case, lower case),
Alphabets (Capital and small caps).
For example: <OL Type=”a”>
<Li> Oil </Li>
<Li> Bread </Li>
</OL>
The list appear as
a. Oil
b. Bread
Unordered List: <UL> Tag
Unordered list can be start with bullets Circle, Disc, Square.
8| Mohammed Ayaz Khan Maulana Azad Jr. College
<DL>
<DT> Term A
<DD> Definition of Term A
<DT> Term B
<DD> Definition of Term B
</DL>
This will be displayed as:
Term A
Definition of Term A
Term B
Definition of Term B
FTP URLs
The file transfer protocol is used to deliver text or binary file over the internet.
For Example: ftp://hostname/path/filename
<A href=”ftp://hostname/path/filename”>Google FTP site</A>.
Gopher URLS
The Gopher protocol is connect to a Gopher site and transfer several different types of files.
For Example:
Gopher://hotname/gophertype
<A href=”Gopher://hotname/gophertype”> University of Chicago gopher site </A>
News Groups:
It refer to new group. A news URL has a format:
News : newsgroup
For example:
<A href=”news : comp.tcs.html”>newsgroup</A>
Telnet URLs
Telnet is communication facility that let you log into other computers or use interactive
services on remote host.
For Example:
<A href=”www.indianikonint.org”> Indian Ikon Coaching Institute </A>
Clicking on hypertext cases the browser to open telnet terminal window and connect to
port 199 on the success.key.edu.
10 | Mohammed Ayaz Khan Maulana Azad Jr. College
<MARQUEE> Tag:
The text which is enclosed within this tag would rolled over horizontal line on the webpage.
This is used to roll the current news or position of different companies in stock market.
For Example: <MARQUEE> POLIO DRIE ON JANUARY 29, 2017 </MARQUEE>
Images:
We can use images, pictures, photographs, which make our page more attractive and good
look. The images can be added with <IMG> tag and its many attributes.
<IMG> Tag
This is image tag. Its purpose is to include graphic images in the body of the webpage. We
can use this tag anywhere in the body like within a paragraph, this image refers as inline
images.
ALT:
When this attribute used with <IMG> tag there will be only the name of image will display
instead of image.
For Example: <IMG SRC=”ADDRESS OF IMAGE” ALT=”NAME OF THE IAMGE”>
ALIGN:
There are different align attributes are used with <IMG>tag.
Align=”top”
11 | Mohammed Ayaz Khan Maulana Azad Jr. College
Align=”middle”
Align=”Bottom”
Example: <IMG SRC=”ADDRESS OF IMAGE” align=”top”>
Example: <IMG SRC=”ADDRESS OF IMAGE” align=”bottom”>
Example: <IMG SRC=”ADDRESS OF IMAGE” align=”middle”>
The default behavior is align=”bottom” which means that the bottom of an image will align
with the bottom of the line of text. By choosing Align=”Top” we request to browser to
display the image at the top of line of the text. Align=”Middle” the browser will display
the image middle of the line of text.
Floating Images:
To float an image left to right side and paragraphs wrap around the image, we used these
attributes.
Align=”left”
Align=”right”
Example: <IMG SRC=”ADDRESS OF IMAGE” align=”right”>
Tables:
Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag),
and each row is divided into data cells (with the <td> tag). The letters td stands for "table
data," which is the content of a data cell. A data cell can contain text, images, lists,
paragraphs, forms, horizontal rules, tables, etc.
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
12 | Mohammed Ayaz Khan Maulana Azad Jr. College
</table>
How it looks in a browser:
<TABLE CELLPADDING=”5”>
W.B script:
The web is by nature client/server environment. The server stores information, client does
processing. With VB script, you add small programs to your pages that are executed on the
server. Web pages are by definition interactive, each time when we click hyper link, we
are taken to another page. This type of interaction requires trip0 to server at each step. The
web page cannot respond to event, such as click of button because THML is not a
programming language. It cannot display date or do simple calculation.
The latest trend in web design is to make pages, active, active pages behaves like an
application, it has its own interface, composed of common windows elements and interacts
to visitor in a manner similar to windows application.
<Script>tag
When we used script language with HTML just write the following tag.
14 | Mohammed Ayaz Khan Maulana Azad Jr. College
<Script language=”VB Script”> when browser read this tag it calls VB script interpreter to
compile and executed the code. The code is placed in event handlers but procedure can
also be included. The following script shows the current data as soon as the page that
contains it is loaded.:
<SCRIPT LANUGAGE=”VB SCRIPT”>
MSG BOX “THE DAT IS “ AND DATE
</SCRIPT>
Scripting allows you to take control of contents of a page and manipulate them with your
program.
</HEAD>
<BODY BGOLOR="CYEN">
<H1 ALIGN="CENTER"> AMUL INIDA </H1>
<HR>
<P> The Amul Inidia is one of the company of Inida.<BR>
Which provids all milk products.<BR>
Product Of Amul so delicious and healthy.
Products available accross the country.
</P>
<OL TYPE="1">
<LI> MILK </LI>
<LI> BUTTER </LI>
<LI> ICEREAM </LI>
<LI> PANEER </LI>
<LI> LASSI </LI>
<LI> SHRIKHAND </LI>
</OL>
<IMG SRC="file:///D:/ice%20creams/12.jpg" WIDTH="85" HEIGHT="100">
<IMG SRC="file:///D:/ice%20creams/5.jpg" WIDTH="85" HEIGHT="100">
<IMG SRC="file:///D:/ice%20creams/10.jpg" WIDTH="85" HEIGHT="100">
<HR>
<H1 ALIGN="CENTER"> TATA </H1>
<P> TATA is oldest comapny of Inida.<BR>
The founder of TATA was JAMSHED TATA.<BR>
TATA Manufacture and works in different areas like.
</P>
<UL TYPE="DISC">
<LI> Vehecles </LI>
<LI> Mobiles </LI>
<LI> Electronics </LI>
<LI> Foods </LI>
16 | Mohammed Ayaz Khan Maulana Azad Jr. College
4.2 Write the exact output the following HTML code with font specifications in
brackets:
<html>
<body>
<h1> List of Books</h1>
<hr>
17 | Mohammed Ayaz Khan Maulana Azad Jr. College
<ul type=”circle”>
<li> how to solve it by computer< /li>
<li> HTML is easy steps< /li>
<li> C++ programming< /li>
</ul>
<ol type=”A”>
<li> Microprocessor Programming< /li>
<li> Networking Essentials< /li>
<li> Microcontrollers< /li>
</ol>
</body>
</html>
Output:
LIST OF BOOKS
o how to solve it by computer
o HTML is easy steps
o C++ programming
A. Microprocessor Programming
B. Networking Essentials
C. Microcontrollers
4.3 Write the HTML code for the following:
Year
</ol>
</body>
</html>
Output:
LIST OF TOPICS
1. Operating system
2. Data Structure
3. C++ Programming
4. HTML
4.5 Write the HTML code for the following:
HTML Code:
<html>
<body>
<table border=”1” cellspacing=”4”>
<tr >
<th rowspane=”2”> Computer Science </th>
<td>Paper 1</td>
<td>Paper 2</td>
<td>Total </td>
</tr>
<tr>
<td>100</td>
<td>100</td>
<td>200</td>
</tr>
</table>
20 | Mohammed Ayaz Khan Maulana Azad Jr. College
</body>
</html>