803 Web Application Class XI Chap 2 Section 2
803 Web Application Class XI Chap 2 Section 2
<head>
<title>My First Webpage</title>
</head>
<body>
<h1 align="center">My First Web page</h1>
<p>Welcome
>Welcome to my first webpage. I am writing this page using a text editor and plain
old html.</p>
<p>By learning html, I’ll be able to create web pages like a programmer<br>
which I am of course.
<!-- Who would have guessed how easy this would be :) -->
<imgsrc="C:\Users\IPWS\\Desktop\graphics\chef.jpg"
chef.jpg" align="bottom" width=130
height=101 alt="Smiling Happy Chef">
<p align="center"> This is my Chef. </p>
</body>
</html>
OUTPUT
You can try inserting images of different types such as PNG, JPEG, GIF, BMP etc.
with all the attributes of img tag.
1.7 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
fortable data, which is the content of a data cell. A data cell can contain text, images,
lists,paragraphs, forms, horizontal rules, tables, etc.
To display a table with borders, you will use the border attribute.
There are various tag, which help us in enhancing the appearance of a web page. Using
<audio> and <video> tags, you will be able to incorporate Multimedia in your webpage and
can make your webpage more alive.
Inserting Audio
To insert an audio<AUDIO>tag is used in a web page.It can be used for any file format like .
MP3 e,.ogg, .wav etc.
Syntax:
Inserting Video
To insert video in the HTML pages video tag is used it supports file formats like .MP4,
.webm, .ogg etc.
Syntax
Try it!
<HTML>
<Head>
<Title> My first page </Title>
</Head>
<Body>
Check the video clip.
<video controls src = “ videofilename.mp4 “ width = 720 height= 540 autoplay>
please check your browser settings </video>
</Body>
</HTML>
Note:
If the browser does not support audio in video tag, then any text placed between
<audio></audio> and <video></video> tag will be displayed in the browser.
1.8 Frames
Syntax
<iframe src= “ “ height=200 width = 200 style= “ border- width: ;border- style:
, Border- color: “></iframe>
Example
<HTML>
<Head>
<Body>
</Body>
</HTML>
Output:
1.9 Forms
Syntax:
1. NAME -This specifies the name of the form. But this name will not be displayed on
the
form. As there can be more than one FORMs in an HTML document, a name is
required to differentiate one form from another. The NAME attribute is
optional if there is only one FORM on the web page.
NAME = "FormName"
2. ACTION - This specifies the URL where the form-data is sent when the form is
submitted.This URL is also called the destination of the form.
ACTION = "URL"
Syntax:
<INPUT TYPE = “FIELD TYPE” NAME = “FIELD NAME” VALUE = “FIELD TEXT”>
Attributes of INPUT element are discussed below:
Attribute:
TYPE
Use: The TYPE attribute determines the field type of input field to be provided in the
form.
Syntax:TYPE = "FieldType"
NAME
Use: Specifies the name of the field. This name does not appear on the FORM. It is
required for the identification/ differentiation as there can be more than one fields in a single
FORM.
VALUE
We will now discuss different field types (values of TYPE attribute) relevant to our syllabus.
1. FieldType: TEXT
Use: It provides a single line text input field where the user can enter text. Additional
Attributes:SIZE = "n" - Sets the visible size of the text field to n characters.
MAXLENGTH = "n" - Set the maximum number of characters that
can be input in the text field to n.
2. FieldType: PASSWORD
Use: It provides a single line text input field where the user can enter password.
A password field is different from a text field because a text field displays
whatever characters are entered by the user whereas a password field shows
one dot for each character input by the user. This is to prevent others from seeing the
password.
3. FieldType: RADIO
Use: It provides a radio button on the form. More than one radio buttons can have
(and in general have) the same name. All the radio buttons that have the same name
constitute a radio group. Only one radio button of a group can be selected at one
time. That is, from a group of radio buttons, if the user selects a button, all the other
buttons in the set are deselected. When a form is submitted, selected radio button's
value (specified by the VALUE attribute) is submitted to the destination.
Additional Attributes:
CHECKED - Indicates that the radio button is selected, which can be deselected
when another choice is made. At one time, only one radio button in a radio group can
be specified as CHECKED.
4. FieldType: CHECKBOX
Use: It provides a check box on the form. With checkboxes, we can give the users a
list of items to choose from. The user can choose more than one items from the list.
We can make a group of checkboxes, by giving them the same name. When a form
is submitted, selected cheboxes' values (specified by the
VALUE attribute) are submitted to the destination.
Additional Attributes:
CHECKED - Indicates that the checkbox is to be displayed with a tick mark to show
selection. This attribute is optional.
5. FieldType: SUBMIT
Use: This provides a button on the form. When this button is clicked, the form is
submitted to the destination.
6. FieldType: RESET
Use: This provides a button on the form. When this button is clicked, the input fields
on the form are reset to their default state.
Example:
TRY IT!
<html>
<b>Gender </b>
<Br>
Comment<Br>
</Form>
</body>
</html>
Points to Remember:
Exercise
Practical Work:
1. Create a website for “Tour and Travel” company.
2. Create a website on the topic – “Digital India”.
3. Create a website on famous Sports of the World.
Note: A website must contain at least 4-5 webpages.
Section-2: Basics About CSS
Cascading Style Sheets (CSS) describe how documents are presented on screens,
in print, or perhaps how they are pronounced. W3C has actively promoted the use of
style sheets on the Web since the Consortium was founded in 1994. Cascading
Style Sheets (CSS) provide easy and effective alternatives to specify various
attributes for the HTML tags. Using CSS, you can specify a number of style
properties for a given HTML element. Each property has a name and a value,
separated by a colon (:). Each property declaration is separated by a semi-colon (;).
Pages load faster – If you are using CSS, you do not need to write HTMLtag
attributes every time. Just write one CSS rule of a tag and apply to all the
occurrences of that tag. So less code means faster download times.
Easy maintenance – To make a global change, simply change the style, and
all elements in all the web pages will be updated automatically.
Superior styles to HTML – CSS has a much wider array of attributes than
HTML so you can give far better look to your HTML page in comparison of
HTML attributes.
Global web standards – Now HTML attributes are being deprecated and it is
being recommended to use CSS. So it’s a good idea to start using CSS in all
the HTML pages to make them compatible to future browsers.
Example First let’s consider an example of HTML document which makes use of
<font> tag and associated attributes to specify text color and font size:
<!DOCTYPE html>
<html>
<head>
<title>HTML CSS</title>
</head>
<body>
<p><font color=“green”size=“5”>Hello, world!</font></p>
</body>
</html>
We can re-write above example with the help of Style Sheet as follows:
<!DOCTYPE html>
<html>
<head>
<title>HTML CSS</title>
</head>
<body>
<p style=“color:green;font-size:24px;”>Hello, World!</p>
</body>
</html>
Hello, World!
Internal Style Sheet – Define style sheet rules in header section of the HTML
document using <style> tag.
Inline Style Sheet – Define style sheet rules directly along with the HTML
elements using style attribute. Let’s see all the three cases one by one with
the help of suitable examples.
If you need to use your style sheet to various pages, then it’s always recommended
todefine a common style sheet in a separate file. A cascading style sheet file will
have extension as css and it will be included in HTML files using <link> tag.
Example
Consider we define a style sheet file style.css which has following rules:
.red{
color: red;
}
.thick{
font-size:20px;
}
.green{
color:green;
}
Here we defined three CSS rules which will be applicable to three different classes
defined for the HTML tags. I suggest you should not bother about how these rules
arebeing defined because you will learn them while studying CSS.
<!DOCTYPE html>
<html>
<head>
<title>HTML External
CSS</title>
<link rel=“stylesheet”
type=“text/css”href=“/html/stml
/style.css”>
/head>
<body>
<p class=“red”>This is red</p>
<p class=“thick”>This is
thick</p>
<p class=“green”>This is
green<p>
<p class=“thick green”>This is
thick and green</p>
</body>
</html>
If you want to apply Style Sheet rules to a single document only then you can include
those rules in header section of the HTML document using <style> tag.
Rules defined in internal style sheet override the rules defined in an external CSS
file.
Example
Let’s re-write above example once again, but here we will write style sheet rules in
the same HTML document using <style> tag:
<!DOCTYPE html>
<html>
<head>
<title>HTML Internal CSS</title>
<style type=“text/css”>
.red{
color: red;
}
.thick{
font-size:20px;
}
.green{
color:green;
}
</style>
</head>
<body>
<p class=“red”>This is red</p>
<p class=“thick”>This is thick</p>
<p class=“green”>This is green</p>
<p class=“thick green”>This is thick and green</p>
</body>
</html>
This is red
This is thick
This is green
You can apply style sheet rules directly to any HTML element using style attribute of
the relevant tag. This should be done only when you are interested to make a
particular change in any HTML element only.
Rules defined inline with the element overrides the rules defined in an external CSS
fileas well as the rules defined in <style> element.
Example
Let’s re-write above example once again, but here we will write style sheet rules
alongwith the HTML elements using style attribute of those elements.
<!DOCTYPE html>
<html>
<head>
<title>HTML Inline CSS</title>
</head>
<body>
<p style=“color:red;”>This is red</p>
<p style=“font-size:20px;”>This is thick</p>
<p style=“color:green;”>This is green</p>
<p style=“color:green;font-size:20px;”>This is thick and green</p>
</body>
</html>
This is red
This is thick
This is green
This is thick and green
A CSS comprises of style rules that are interpreted by the browser and then applied
to the corresponding elements in your document. A style rule is made of three parts:
Selector: A selector is an HTML tag at which style will be applied. This could
be any tag like <h1> or <table> etc.
Property: A property is a type of attribute of HTML tag. Put simply, all the
HTML attributes are converted into CSS properties. They could be color or
border etc.
Value: Values are assigned to properties. For example, color property can
have value either red or #F1F1F1 etc.
Here table is a selector and border are a property and given value 1px solid #C00 is
the value of that property. You can define selectors in various simple ways based on
your comfort. Let me put these selectors one by one.
h1 {
color: #36CFFF;
}
{
color: #000000;
}
This rule renders the content of every element in our document in black.
ul em {
color: #000000;
}
The Class Selectors
You can define style rules based on the class attribute of the elements. All the
elements having that class will be formatted according to the defined rule.
.black {
color: #000000;
}
This rule renders the content in black for every element with class attribute set to
blackin our document. You can make it a bit more particular.
For example:
h1.black {
color: #000000;}
The ID Selectors
You can define style rules based on the id attribute of the elements. All the elements
having that id will be formatted according to the defined rule.
#black {
color: #000000;
}
You have seen descendant selectors. There is one more type of selectors which is
very similar to descendants but have different functionality. Consider the following
example:
body > p {
color: #000000;
}
This rule will render all the paragraphs in black if they are direct child of <body>
element.
Other paragraphs put inside other elements like <div> or <td> etc. would not have
any effect of this rule.
input[type=“text”]{
color: #000000;
}
The advantage to this method is that the <input type=“submit” /> element is un
affected, and the color is applied only to the desired text fields.
p[lang=“fr”] - Selects all paragraph elements whose lang attribute has a value
ofexactly “fr”.
p[lang =“fr”] - Selects all paragraph elements whose lang attribute contains
the word“fr”.
You may need to define multiple style rules for a single element. You can define
these rules to combine multiple properties and corresponding values into a single
block as defined in the following example:
h1 {
color: #36C;
font-weight: normal;
letter-spacing: .4em;
margin-bottom: 1em;
text-transform: lowercase;
}
Here all the properties and value pairs are separated by a semi colon (;). You can
keep them in a single line or multiple lines. For better readability we keep them into
separate lines.
Grouping Selectors
You can apply a style to many selectors if you like. Just separate the selectors with a
comma as given in the following example:
h1, h2, h3 {
color: #36C;
font-weight: normal;
letter-spacing: .4em;
margin-bottom: 1em;
text-transform: lowercase;
}
This define style rule will be applicable to h1, h2 and h3 element as well. The order
of the list is irrelevant. All the elements in the selector will have the corresponding
declaration sapplied to them.
We have discussed four ways to include style sheet rules in a HTML document. Here
is the rule to override any Style Sheet Rule.
Any inline style sheet takes highest priority. So, it will override any rule
defined in<style>...</style> tags or rules defined in any external style sheet
file.
Any rule defined in external style sheet file takes lowest priority and rules
defined in this file will be applied only when above two rules are not
applicable.
CSS Comments
Many a times you may need to put additional comments in your style sheet blocks.
So, it is very easy to comment any part in style sheet. You simply put your comments
inside /*this is a comment in style sheet*/.
You can use /* ....*/ to comment multi-line blocks in similar way you do in C and C++
programming languages.
Example
A hexadecimal value can be taken from any graphics software like Adobe
Photoshop, Jasc Paintshop Pro or even using Advanced Paint Brush.
Each hexadecimal code will be preceded by a pound or hash sign #. Following are
the examples to use Hexadecimal notation.
This colourr value is specified using the RGB(( ) property. This property takes three
values, one each for red, green, and blue. The value can be an integer between 0
and 255 or a percentage.
Note: All the browsers do not support RGB() () property of color so it is recommended
not to use it. Following is the example to show few colors using RGB values.
Following is the example which demonstrates how to set the background image for
an element.
<table style=“background
style=“background-image:url(/https/www.scribd.com/images/pattern1.gif);”>
<tr><td>
This
Set thetable has background
background image set.
image position
</td></tr>
</table>is the example which demonstrates how to set the background image
Following
position 100 pixels away from the left side.
<table style=“background
style=“background-image:url(/https/www.scribd.com/images/pattern1.gif);
background-position:100px;”>
position:100px;”>
<tr><td>
Background image positioned 100 pixels away from the left.
</td></tr>
</table>
Set the background attachment
<p style=“background-image:url(/https/www.scribd.com/images/pattern1.gif);
background-attachment:scroll;”>
This parapgraph has scrolling background image.
</p>
This will teach you how to set fonts of a content available in an HTML element. You
can set following font properties of an element:
The font-family property is used to change the face of a font.
The font-style property is used to make a font italic or oblique.
The font-variant property is used to create a small-caps effect.
The font-weight property is used to increase or decrease how bold or light a
font appears.
The font-size property is used to increase or decrease the size of a font.
The font property is used as shorthand to specify a number of other font
properties.
Following is the example which demonstrates how to set the font family of an
element.
Possible value could be any font family name.
<p style=“font-family:georgia,garamond,serif;”>
This text is rendered in either georgia, garamond, or the default
serif font depending on which font you have at your system.
</p>
Following is the example which demonstrates how to set the font style of an element.
Possible values are normal, italic and oblique.
<p style=“font-style:italic;”>
This text will be rendered in italic style
</p>
Set the font variant
Following is the example which demonstrates how to set the font variant of an
element.
<p style=“font-variant:small-caps;”>
This text will be rendered as small caps
</p>
Following is the example which demonstrates how to set the font size of an element.
The font size property is used to control the size of fonts. Possible values could be
xx-small, x-small, small, medium, large, x-large, xx-large, smaller, larger, size in
pixels or in %.
<p style=“font-size:20px;”>
This font size is 20 pixels
</p>
<p style=“font-size:small;”>
This font size is small
</p>
<p style=“font-size:large;”>
This font size is large
</p>
This tutorial will teach you how to manipulate text using CSS properties. You can set
following text properties of an element:
Following is the example which demonstrates how to set the text color. Possible
value could be any color name in any valid format.
<p style=“color:red;”>
This text will be written in red.
</p>
Following is the example which demonstrates how to set the direction of a text.
Possible values are ltr or rtl.
<p style=“direction:rtl;”>
This text will be renedered from right to left </p>
Following is the example which demonstrates how to set the space between
characters. Possible values are normal or a number specifying space.
<p style=“letter-spacing:5px;”>
This text is having space between letters.
</p>
Following is the example which demonstrates how to align a text. Possible values
are left, right, center, justify.
<p style=“text-align:right;”>
This will be right aligned.
</p>
<p style=“text-align:center;”>
This will be center aligned.
</p>
<p style=“text-align:left;”>
This will be left aligned.
</p>
CSS – Images
Images are very important part of any Web Page. Though it is not recommended to
include lot of images but it is still important to use good images wherever it is
required.
CSS plays a good role to control image display. You can set following image
properties using CSS.
The border property of an image is used to set the width of an image border. This
property can have a value in length or in %. A width of zero pixels means no border.
Here is the example:
Exercise Question
2. What are the ways in which you can use CSS in your HTML document?
(a) ____________ Defines style sheet rules in a separate .css file and then include
(c) A cascading style sheet file will have extension as __________ and it will be
included in HTML files using ____________ tag.
Practical Work:
The Domain Name System (DNS) is the directory that maps domain names to IP
addresses. DNS is built around the hierarchical domain namespace that we dis-
cussed earlier. DNS is a distributed directory and serves as enabling infrastructure
for a single, global directory of domain names. This directory is built from
thousands of servers owned by thousands of organizations around the world.
Host aliasing:
A host with complicated hostname can have one or more alias names. DNS can be
invoked by an application to obtain the canonical hostname for a supplied alias
hostname as well as the IP address of the host.
DNS can be invoked by a mail application to obtain the hostname for a supplied alias
hostname as well as the IP address of the host.
Name spaces are of two types: Flat name spaces and Hierarchical Names. The
name assigned to machines must be carefully selected from a namespace with
complete control over the binding between the names and IPaddresses.
Hierarchical names:
The partitioning of a namespace must be defined in such a way that it: Supports
efficient name mapping and Guarantees autonomous control of name assignment.
Hierarchical namespaces provides a simple yet flexible naming structure. The
namespace is partitioned at the top level. Authority for names in each partition are
passed to each designated agent The names are designed in an inverted-tree
structure with the root at the top.
The Doman Name System (DNS) is used to map a name to a static IP address.
Computers use these to communicate with themselves using aa name. When a
computer requests a URL the DNS translates that name into the corresponding IP
address.
When you sign up for a Web site, one of the first things you ’il have to do is determine
a domain name for your site. Then, you register your domain name with n domain
registrar.
Domain registrars register your domain name and hook you up to the Internet by
making sure your domain name is added to a huge database of domain names that
are mapped to specific IP addresses.
Some Web hosting companies actually take care of this process for you, so you
may be able to skip these steps. Some registrars also act as hosting services, and
will try to sell you a hosting plan. Keep in mind that you’re under no obligation to host
your site using the services of the registrar you use to register your site.
The Final phase of creating a web site is publishing your pages. To place your pages
on the web you need a web server. Commonly called hosts, web servers allow you
to transfer and store files including HTML documents, images and multimedia files.
Unless you have your own web server, you need to find a server to host your pages.
http://www.godaddy.com/
http://www.1and1.com
http://www.virtualempre.com
But of course there are many more, Make sure you choose a webhost which
supports FTP, which makes it much easier to publish your pages from web builder.
Page to publish
In this section of the publish window you can select which pages to publish.
Entire website
Publishes all pages of the website (except the pages which have enabled ‘Don’t
publish this page’ in page properties)
Publish the select page, click ‘select’ to specify the page to be published. Note
that you can also select a folder.
Select this option if you do not want to upload images or other components along
with the HTML file.
Select this option if you want to publish the files that were changed since the last
time you’ve published your web site.
What to do in case of publishing errors?
Make sure your ftp address (host), username and password is valid.
Use ‘Test connection’ to verify the specified data.
Make sure you the remote folder is correct! Consult the documentation of your
host for this value!
Use of ‘Explore’ button to browser to the remote folder.
If the pages don’t show up on your website you’ve probably specified the
wrong remote folder.
Does your firewall block the FTP connection of WYSIWYG Web Builder?
Enable ‘Use passive mode for transfers’
If the transfer takes a long time then you’ve probably used very large images.
More details.
Increase the connection timeout to 120 seconds or longer (Menu(Menu->Tools-
>Options->publish)
If you website doesn’t look to be updated, select ‘Refresh’ in your browser
multiple times!
Enable the publish log in Menu
Menu->Tools->Options->Publish
>Publish and make
mak note of
the error message.
For a list of all possible error codes and their descriptions go
here : http://support.microsoft.com/default.aspx?scid=kb;EN
http://support.microsoft.com/default.aspx?scid=kb;EN-US;193625
US;193625
May be there is a temporary problem with your host? Check if you can
connect using a FTP client.
99.99% of all publishing errors are the result of an invalid configuration,
please verify the specified Data!
Points to Remember:
Exercise Questions
Q. 1: What do you understand by website and webpage publishing?
Q. 2: Explain webpage, website and webserver?
Q. 3: In how many ways you can publish your web pages?
Q. 4: How many types of files you can publish on webserver?
Q. 5: State five errors which are commonly occur during publishing of any
website?
Further Readings
Book-1 Kogent Learning Solutions, “HTML BLACK BOOK,” 4th Edition,
DreamtechPress, 2012
Book-2 Elisabeth R, Eric F, “Eric f, “Head first HTML and CSS,” 2nd Edition,
O’REILLY ,2013
Website 1: www.w3schools.com
Website 2: www.thenewboston.com
Website 3: www.godaddv.com
Website 4: www.freeserver.com