HTML Document BCA PDF
HTML Document BCA PDF
<html>
<head>
<title>Home</title>
</head>
<body>
This is a basic structure HTML page.
</body>
</html>
Basic Tags:
There are four basic tags: 1.<HTML>, 2.<HEAD>, 3.<TITLE>, 4.<BODY>
1. <HTML> :
be the first
thing to appear after the opening <html> tag. <head> element should contain a
<title> element
Indicating the title of the document.
head: <script>, <style>,<link>.
3. <TITLE> :
<BODY> :
The <body> element appears after the <head> element and contains the part of
the Web page that
you actually see in the main browser window, which is sometimes referred to as
body
content.
All tags which apply some effects to text, image or anything that means
everything you seen and
appearing on web page that are placed between under <body> tag and </body>
tag.
HTML - Attributes of the body tag
o bgcolor: This attribute sets the background color of webpage. Ex: <body
bgcolor=”yellow”>
o text: This attribute sets the text color for the webpage. Ex: <body text="red" >
What is Tag?
Tag is an instruction given to web browser to show formatted data in webpage.
Following are types of tags.
1) Singular (Unpaired) tag: this type of tag consists of only starting tag to
provide single action. Some
tag don’t require end tag because they don’t have enclosed content.
Ex:- <BR>, <HR> tag.
2) Paired tag: this type of tag consist of start tag & respectively end tag to define
the scope.
Start tag is a symbol for surrounded by angle bracket’s <HTML> & end tag is
represented by forward slash
within angle bracket such as </HTML>.
Syntax: Start tag <tagname> Text End tag </ tagname >
Ex: <Title> Home </Title>
Attributes:
Tags can also have attributes, which are extra bits of information. Attributes
appear inside the opening tag only and
Their value followed by = sign is always inside double quotation marks “ ”.
Formatting Tags:
Heading tag - <h?>Text</h?>
One of the earliest means of formatting text was the heading tag. It is available in
six levels of importance from
<h1>down to <h6>, If you have documents with genuine headings, then there are
HTML tags specifically designed
just for them.
They are h1, h2, h3, h4, h5 and h6, h1 being the biggest of headings and h6 being
the smallest
Program:
<html>
<head><title>Font Size Example</title></head>
<body>
<h1>This is a main big heading </h1>
<h2>This is a main sub heading </h2>
<h3>This is a sub heading </h3>
<h4>This is a heading </h4>
<h5>This is a small heading </h5>
<h6>This is a smallest heading </h6>
</body>
</html>
Output:
Note that the h1 tag is only used once - it is supposed to be the main heading of
the page and have bigger and bold
text appearance. h2 to h6 can used repeatedly, but they should always be used in
order, For example, h4 should be a
Sub-heading of an h3, and h3 which should be a sub-heading of an h2.
Paragraph Tag: <P>
the paragraph tags are used to define a block of text as a paragraph.
when a block of text is surrounded by the paragraph tags, the browser
automatically adds new line before
and after the paragraph text.
the <p> element offers a way to structure your text. Each paragraph of text
should go in between an
Opening <p> and closing </p> tag
<p>The contents of the paragraph.</p>
If you are using an empty paragraph tag like this <p> </p> it will create new line
Whenever you write <p> tag after paragraph tag automatically single new line
will appear means if you use two <p>
tag one after one then two paragraph appear on new line. Also, if you have extra
spaces in between your words the
browser ignores that, extra spaces are automatically ignored throughout the html
except appeared in <pre> tag.
But If you want extra space after it or if this is what you want as the formatting
for all paragraphs, use & nbsp if you
want extra space in between text.
<p>Hello nbsp; nbsp; nbsp; nbsp; world.</p> : Output= Hello world.
Paragraph tag is basic text formatting tag which specifically used to create
multiple line of text.
Paragraph Tag Attributes
align – Align is used to apply aligning to the text as left, right, center.
o Ex: <p align=”right”>Text</p>
APPLE
Try the PRE tag on your website with various different spacing and carriage
returns.
For example, try pasting the following code into your web page HTML (leave the
spaces exactly as they are
written):
Code with PRE tag: <pre>
A
P
P
L
E
</pre>
Output:
A
P
P
L
E
The PRE tag leaves the whitespace characters alone. So line breaks, spaces, and
tabs are all maintained in
The browser.
List Tags:
Introduction to lists
List tag is to create lists in web page. HTML offers some tags for specifying
lists of information. All lists must
contain one or more list elements (items).
There are three types of lists are present:
1) Ordered List- <OL>
2) Unordered List- <UL>
3) Definitions- <DL>
Lists are especially useful in web pages to draw attention to short pieces of
information. Keep that in mind
when you create your lists, and try to include short phrases, instead of long
sentences, in each list item.
1] Ordered List- <OL> tag:
An ordered list is one in which each item is presented by a number or letter.
Ordered list always
represent data in sequence or order either it is number or alphabet.
Program: <html>
<head>
<title>Font Size Example</title>
</head>
<body>
<ol type="I">
Courses:
<li> BCA </li>
<li> BSc(CS)</li>
<li> BSc(SE)</li>
<li> BBA</li>
</ol>
</body>
</html>
Output:
Courses:
I. BCA
II. BSc (CS)
III. BSc (SE)
IV. BBA
<OL> tag: Values of TYPE Attributes:
Values of TYPE Attribute Numbering Style Example
1 Numbers 1, 2, 3, 4, 5, 6
a Lowercase Alphabet a, b, c, d, e, f
A Uppercase Alphabet A, B, C, D, E, F
i Lowercase Roman Numbers i, ii, iii, iv, v, vi
I Uppercase Roman Numbers I, II, III, IV, V, VI
</body>
</html>
Output:
Table:
A table is created using three tags: <table> <tr> and <td>. The tag table is the
container
of the whole table.
<table>
------
</table>
HTML table tags
Tag Meaning
Table Represents the whole table
tr Represents a row
td Represents a cell in a row
th Column header
caption Title of the table
A table consists of a number of rows each of which is made up of a number of
cells. The
tag <tr> creates a row.
The opening tag <tr> and closing tag </tr> respectively
<table>
<tr>…..</tr>
<tr>…..</tr>
</table>
A table or a row cannot contain data. To add dat, cells are created within a row.
Each
cell in a row is defined by the tag <td>. Usual tags such as <p>, <br>, <i>, <b>
may be
used within a cell
<table>
<tr><td>….</td><td>….</td><tr>
<tr><td>….</td><td>….</td><tr>
------
</table>
Border:
Adding a table border is very simple. A value 0 (zero) indicates no border
<table border=”1”>
<tr><td>33</td><td>55</td></tr>
<tr><td>66</td><td>77</t
d></tr> </table>
Row and column header:
The tag <th> is used to add row/column headers. They are also added using
cells.
Rows/column headers are center-aligned and in bold font, which distinguishes
them
from other cells.
<table border=”1”>
<tr><th>Name</th><th>Place</th><tr>
<tr><td>Balan</td><td>Chennai</td></tr>
</table>
Rowspan and colspan:
To make a cell span multiple rows and columns, the tags <rowspan> and
<colspan> are
used. The tag <rowspan> indicates the number of rows a cell spans while
<colspan>
indicates the number of columns a cell spanes.
<table border=”1”>
<tr><th rowspan=2>Name</th>
<th colspan=2>Marks</th></tr>
<tr><th>OS</th><th>OOP</th></tr>
<tr><td>Sunjay</td><td>88</td><td>77</td></tr></table>
HTML
Document.
it is used to collect information from visitors. In addition to usual contents and
markups,
it contains special elements called controls.
HTML provides several control elements such as buttons, text boxes, password
fields,
check boxes, radio buttons, selection boxes hidden fields etc.
The tag <form> is a container tag. <form> ---- </form>
The tag <form> has another optional attribute method which specifies the
HTTP method
to be used. It can have values GET or POST.
IF GET (the default) is used, the data are appended to the URL
IF the POST method is used, data are sent as a part of the HTTP request message
and
are not appended to the URL.
<form action=”handler.jsp” method=”post”>
---------------
</form>
Attributes of the input tag
Attribute Meaning
Type Specifies the type of a control element
name Specifies the name of a control element
value Specifies the initial value of the control element
checked Used for checkbox and radio buttons, indicates that the controls is on.
readonly Used for text, password, and file controls
disabled It set disables controls from the user input
maxlength Specifies the maximum number of characters a user can enter in a
text or password.
Text field:
The most commonly used input element is text field. It is used to get single-
line textual
data.
Its common usage include name, date of birth, address, email address, login
name etc.
Name <input type=”text” name=”name”>
Password field:
Password fields are similar to text fields except that characters entered are
displayed as
dots or asterisks. This allows us to hide information from others. All the attributes
of a text field
are also valid for a password field.
Password: <input type=”password” name=”pass”>
Label:
The content of the <label> tag is a piece of ordinary text. It is used to add a label
to a form field.
<label for=”married”>
Married
<input type=”checkbox” id=”married”>
</label>
Check box:
A checkbox is like a toggle switch i.e., it can be either of the two states checked
or
Unchecked. Checkboxes allow visitors to select one (or more) options from a set
of related
Alternatives. A checkbox is created using the <input> tag and specifying the
type=”checkbox”
Which of the following items do you have?<br>
<input type=”checkbox” name=”c1” values=”yes”>Car<br>
<input type=”checkbox” name=”c2” values=”yes”>Bike
Radio button
Radio buttons allow visitors to select any one among a set of related
alternatives. When
one radio button is a group is selected, the previously selected radio button (if
any) is
unselected.
Radio buttons are unchecked by default. A checkbox is created using the
<input>tag and
by specifying type=”radio”
Gender:<br>
<input type=”radio” name=”gender” value=”Male”>Male<br>
<input type=”radio” name=”gender” value=”Female”>Female
Selection list:
A selection list (also called the drop-down list), like a group of radio buttons
or
checkboxes, allows visitors to choose one (or more) options among a set of
options.
A selection list is created using the <select> tag. Items of a selected list are
created using
the <option> tag. By default, the first option is displayed.
Gender:
<select>
<option>Male
<option>Female
</select>
Text area:
A text area is an extension of a text field, where the text can span multiple
lines. It is
used when visitors want to enter a large amount of text.
The number of rows and columns may be set using the attributes rows and cols
respectively.
Comment:<br>
<textarea rows=”4” cols=”20”>
Enter your comment here
</textarea>
Button:
Push Buttons can be created using the <input> tag, with the type attribute set to
“button”. The caption is the value of the value attribute of the input tag.
<input type=”button” value=”Logout”>
Image button:
The submit button in a form has a gray colored simple appearance, unless you
use styles
for it.
A simple way to create a good looking graphic submit button is to use the
<input> tag
with attribute set to “image”
<input type=”image” src=”rightarrow.gif”>
Frame:
HTML allows us to divide a web page into several blocks called frames. Each
frame may
display a separate web page. So , frames allow us to display multiple HTML
document in one
browser window simultaneously. They are refreshed separately.
For example, the following code creates two frames separated vertically
<frameset cols=”40% 60%”>
<frame name=”left” src=”left.html”>
<frame name=”right” src=”right.html”>
</frameset>
Frameset Element:
The layout of a document is specified using the <frameset> element.
The <frameset> element is put in the parent HTML document without any
<body> tag.
It contains <frame> elements each of which creates a frame. For example
frameset
element vertically divides the page into two blocks (frames).
The left frame is set to 40% of the total page width and right frame is set to
60% of the
total page width.
Frame Element:
The element <frame> specifies the HTML document to be loaded in each frame.
It has
several attributes as follows:
name – refers to the name of the frame
src – specifies the location of the initial web page to be loaded.
framz`eborder – specifies the border information about the frame
marginwidth – specifies the amount space of pixels to be added between the
frame’s contents in its left and right margins.
marginheight – specifies the amount of space in pixels to be added between the
frame’s contents in its top and bottom margins.
Layout:
Each frameset creates a set of rows or columns
<frameset rows=”30%, 70%”>
<frame name=”top” src=”top.html”>
<frame name=”bottom” src=”bottom.html”>
</frameset>
This frameset element divides the page horizontally into two frames. The top
frame is
set to 30% of the total page height and the bottom frame is set to 70% of the total
page
height.
The attribute of frameset element
cols – This attribute is used to create frames vertically
rows – This attribute is used to create frames horizontally