Hyper Text Markup Language (HTML) : Unit 5
Hyper Text Markup Language (HTML) : Unit 5
Hyper Text Markup Language (HTML) : Unit 5
Web Server
A Web server is a system that delivers content or services to end users over the Internet. A
Web server consists of a physical server, server operating system (OS) and software used to
facilitate HTTP communication. A Web server is also known as an Internet server.
Web Client
The Web client is a client-side component within the Java 2 Platform Enterprise Edition
(J2EE), a distributed multi-tiered application model used for building and developing enterprise
applications. Client-side components are typically computer applications running on a user's
computer and connect to a server.
Web Page
A Web page is a document for the World Wide Web that is identified by a unique
uniform resource locator (URL).A Web page can be accessed and displayed on a monitor or
mobile device through a Web browser .
Web Browser
A Web browser is a software program that allows a user to locate, access, and display Web
pages. In common usage, a Web browser is usually shortened to "browser." Browser allows web
client to:
The text between the start and end tags is the element content. HTML tags are not case
sensitive, <b> means the same as <B>
The general form for a tag is:
< tag_name > Text </tag_name>
There are many tags in HTML, and each one tells the browser a piece of information
about how it should display the text between the tags.
Example for tag in html.
<html> this is html page </html>
HTML tags can be of two types
Paired Tags:
A tag is said to be a paired tag if the text is placed between a tag and its companion tag.
In paired tags, the first tag is referred to as Opening Tag and the second tag is referred to as
Closing Tag. For example the <b> tag is a paired tag. The <b> tag with its companion tag
</b> causes the text contained between them to be rendered in bold. The effect of other
paired tag is applied only to the text they contain.
The opening tag activates the effect and the closing tag turns the effect off.
Singular Tags:
The second type of tag is the singular or stand-alone tag. A stand-alone tag does not have
a companion tag.
For example <br/> tag will insert a line break. This tag does not require any companion tag.
Steps Involved In Creating HTML File:
Following are the 4 steps below to create your first web page with Notepad.
STEP 1: Open Notepad
Open command prompt and type notepad and press enter.
STEP 2: Write HTML code.
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
In notepad From the File pull-down menu, Select "Save As". Change the
"Save As Type" option on the bottom from "Text Document" to "All
Files".
Save the file to the Desktop, and name the file using the ".html" extension
(e.g., "home.html").
Every HTML program has a rigid structure. The entire web page is enclosed within <html>
</html> tags. Within these tags two distinct section are created using the <head> </head> tags
and the <body> </body> tags.
These are described below
Document head: Information placed in this section is essential to the inner workings of
document and has nothing to do with the content of the document. With the exception of
information contained within the <title> </title> tags, all the information placed within the
<head></head> tags is not displayed in the browser.
The HTML tags used to indicate the start and end of the head section are: <head>
<title>…………….</title>
</head>
Document body: The tags used to indicate the start and end of the main body of textual
information are:
<body>
…………….
</body>
Page defaults like background color, text color, font size, font weight and so on can be
specified as attributes of the <body> tag. The attributes that the <body> tag takes are:
CSS Background Formatting (background-color :) – Set the default background-color
property to the background-color of an element. This tag is written in the CSS (Cascading
Style Sheets) file.
CSS Background Formatting (background-color :) - Set the background-image property
of an element or of the document. This tag is written in the CSS file.
TEXT – Changes the body text color from its default value to the color specified
with this attribute.
Example:
<body style=”background:url(abc.gif); color:red;”>
Titles
A web page could have a title that describes what the page is about without being too wordy. This can be
achieved by using the title tag. Text included between<title>……</title> tag shows up in the title bar of the
browser window.
<title>……..</title>
Titles
Just as a title can be placed in title bar of the browser window, certain information is commonly placed
at the foot of the web page. This tag should be ideally be placed immediately after the last line of the
textual material of the web page.
However, it could also be placed anywhere in the body of the document. The text typed
within these tags always appears in Italics.
Copyright information, contact details of the creater of the web page and so on are the
type of information traditionally placed bat the foot of the web page.
The HTML tags are: <address>……..</address>
Example:
<head>
<title>this is the title</title>
</head>
<body >
::::::::::::::
<address>this is footer </ address > </body>
Text Formatting
Paragraph breaks
A blank line always separates paragraphs in textual materials. The tags that provides this
functionality is <p>. On encountering this tag the browser, moves on to new line, skipping one
line between the previous line and the new line.
Example:
<body >
HTML (Hypertext Markup Language) is the set of markup symbols or codes
inserted in a file intended for display on a World Wide
Web browser page. <p>The markup tells the Web browser how to display a
Web page's words and images for the user.</p>
</body>
Line breaks
When text needs to starts from a new line and not bontinue on the same line
(without skipping a blankline), the <br/> tag should be used. This tag simply jumps to
the start of the next line.
Example:
<body >
HTML stands for (Hypertext Markup Language).<br/> It is used to create web
pages </body>
Heading Styles:
HTML supports six different levels of headings. The highest-level header format is
<h1> and the lowest level is<h6>.
All the styles appear in BOLDFACE and size of heading depends on the level choosen.
ie.<h1> to <h6>
As the number next to<h><(1,2…..) increases the font size actually decreases.
Example:<h1> This is heading </h1>
Drawing lines
The tag <hr> draw lines and horizontal rules. This tag draws a horizontal line across
the whole page wherever specified. The attributes to the <hr> tag are
ALIGN – aligns the line on the browser screen, which is by default, aligned to the center of
the screen..
ALIGN =LEFT will align the line to the left of the screen.
ALIGN =RIGHT will align the line to the right of the screen.
ALIGN =CENTER will align the line to the center of the screen. SIZE –
Changes the size of the rule.
WIDTH – Sets the width of the rule. It can be set to fixed number of pixels, or to a
percentage of the available screen width..
Example:
Welcome to our web site
<hr align=”left” width=”10” size=”4”/>
Text Styles
Bold:
Displays the text in BOLDFACE style. The tags used are between <b> …</b>.
Example:
<b> Welcome to our web site.</b>
Italics:
Displays the text in ITALICS style. The tags used are between <i>…. </i>.
Example:
<i> Welcome to our web site </i>.
Underline:
Displays the text in UNDERLINED style. The tags used are between <u> ….
</u>.
Example:<u> Welcome to our web site </u>.
Spacing(Indenting Text):
The tag used for inserting blank space in an html document is <spacer>its
attributes are:
TYPE – to specify whether space has to be left horizontally or vertically.
SIZE – indicates the amount of space to be left. Size accepts any integer.
Example:
font-family: – Sets the text to the specified font for the specified element. font-size - Sets the
size of the text. font-size value can be absolute(px or em) or can be relative(%).
color – Sets the color of the text. Color can be set to English language name,
hexadecimal or RGB value.
Example:
<p style=”font-family: Comic Sans MS; font-size:10px; color:red;”> Welcome
to our web site.</p>
Lists
Types of lists:
Unordered list(bullets): An unordered list starts with the tag <ul> and ends with </ul>.
Each list item starts with the tag <li>. Attributes and css\style properties which can be
specified with <li> are:
css list-style-type: – specifies the type of the bullet.
Example:
css\style counter rese :– The counter-reset property creates or resets one or more counters.
Example:
Example:
<dl>
BORDER – specifies the size of the border to place around the image. This attribute
should be specified in the CSS.
WIDTH - Specifies the width of the image in pixels. HIGHT -
Specifies the hight of the image in pixels.
css/style PADDING – indicates the amount of space to the left, right, top and bottom of the
image. This attribute should be specified in the CSS.
ALT– indicates the text to be displayed in case of browser is unable to display the
image specified in the SRC attribute.
SRC – Specifies the location and name of the image file.
Example:
<html>
<body>
Example for image attribute<br/>
<img src=”images/html.gif” style=”border-width:3px;” height=”200”
width”200” alt=”The Html”>
<body><html>
Linking Documents
Links:
HTML allows linking to other HTML documents as well as images. Clicking on a section
of text or an image in one web page will open an entire web page or an image. The text or an
image that provides such linkages is called hypertext, a hyperlink or hotspot. The browser
distinguishes hyperlink from normal text. Every hyperlink, Appears blue in color. The
hyperlink text/image is underlined. When the mouse cursor placed over it the standard arrow
shaped mouse cursor changes to the shape of hand. The blue color which appears by default
can be over-ridden. To change these link colors, there are three attributes that can be specified
with the <body> tag these are:
css\style a:link or a:active or a:visited : Changes the default color of hyper a
hyper link to what ever color is specified with this tag. The user can specify the
color name or equivalent hexadecimal number. It controls placing a caption with
respect to table.
Links are created in webpage using the <a>…</a> tags. Anything written between the
<a></a> tags become hyperlink or hotspot.
The documents to be navigated needs to be specified. By using the href attribute of the <a>
tag the next navigate webpage or image can be specified.
Syntax:<A href=”filename.html”>
Links:
Just as text can act as hyperlink, so also image can act as hyperlink. Anything included
within<a>…</a> tags become a hotspot. An image can be made a hotspot by enclosing an
<img> tag within the <a>….</a> tags
Frames.
Introduction to Frames:
Until now each web page when opened takes over the entire browser screen. The browser
screen could not be split into separate (unique) sections, showing different but related
information.
The HTML tags that divide a browser screeninto two or more HTML recognizable unique
regions. Each unique region is called frame. Each frame can be loaded with a different
document and hence, allow multiple HTML documents to be seen concurrently.
The <frameset> tag:
The splitting of browser screen into frames is accomplished with the <frameset> and
</frameset> tags embedded into the HTML document. The <frameset>….</frameset> tags
required one of the following two attributes depending on wether thescreen has to be devided
into rows or columns.
Rows: This attribute is used to divide the screen into multiple rows. It can be set equal to a list
of values. Depending on the required size of each row.
Columns: This attribute is used to divide the screen into multiple columns. It can be set equal
to a list of values. Depending on the required size of each column.
Once the browser screen is divided into rows(horizontal sections) and columns(vertical
sections) each unique section defined can be loaded with different HTML documents. This
is achived by using the <frame> tag which takes in the following attributes:
Src=”url”: Indicates the URL of the document to be loaded into the frame.
Scrolling: Controls the appearance of horizontal and vertical scrollbars in a frame. This
takes the values YES/NO/AUTO.
Example:
<html>
<frameset rows=”30%,*”> Divides the screen into 2rows, one
occupying 30% of the screen, and
other occupying the remaining.
<frameset cols =”50%,50%’> Divides the 1st row into 2 equal
columns, each 50% of the screen.
<frame src=”file1.html”> loads 1st frame with file1.html
<frame src=”file2.html”> loads 2nd frame with file2.html
</frameset>
<frameset cols =”50%,50%’> Divides the 2nd row into 2 equal
columns, 50% of the screen.
<frame src=”file3.html”> loads 1st frame with file3.html
<frame src=”file4.html”> loads 2nd frame with file4.html
</frameset>
</frameset>
</html>
Tables
Introduction:
Header rows: the row that spans across column of a table is called the header
row. A table header row is defined using <th>….</th>. The content of table
header row is automatically centered and appears in boldface.
Data Rows: Individual data cells placed in the horizontal plane creates a data row.
There could be single data or multiple data. Data cells hold data that must be
displayed in the table
The attributes that can be included in the <table> tag are: