Web Technologies Module 1
Web Technologies Module 1
MODULE I
INTRODUCTION
WWW
● Stands for World Wide Web.
● Tim Berners-Lee, in 1980 was investigating how computer could store information with
random links. In 1989, he proposed an idea of global hypertext space in which any
network-accessible information could be referred to by single “Universal Document
Identifier”. After that in 1990, this idea expanded with further program and known as
World Wide Web. Further developments led to browser and web server. First server was
equipped with URIs, HTML and HTTP specifications. Tim Berners-Lee formed the
World Wide Web Consortium (W3C) in 1994 as a neural form to discuss and agree on
new computer protocols.
● The World Wide Web (WWW) is a global information medium which users can read and
write via computer connected to the internet. It is basically a system of Internet servers
that support specially formatted documents. The documents are formatted in a markup
language called HTML (Hypertext Markup Language) that supports links to other
documents, as well as graphics, audio, and video files.
● In short, World Wide Web (WWW) is collection of text pages, digital photographs, music
files, videos, and animations you can access over the Internet.
● The basic purpose of both is to develop a platform for internet web directory, so that any
users can anytime access any kind of website.
Web Browser
● Web browser is a client, program, software or tool through which we sent HTTP request
to web server.
● The main purpose of web browser is to locate the content on the World Wide Web and
display the web page with image, audio or video form.
● The pages are located using URLs.
● The web browser connects to a web server for desired information. If the requested data
is available in the web server then it will send back the requested information again via
web browser.
● Browsers support JPEG,GIF and PNG images.More file types can be supported using
plugins.
● Eg: Microsoft Internet Explorer, Mozilla Firefox, Opera and Google
Web Server
● Web server is a computer system, which provides the web pages via HTTP (Hypertext
Transfer Protocol). IP address and a domain name is essential for every web server.
● Storing, processing and delivering web pages to clients are its main function. All the
communication between client (web browser) and server takes place via HTTP.
● When user enters a URL or web address into the web browser, this sends request to the
web address where domain name of the URL is already saved. Then this server collects
the information of your web page and sends to browser, which will be displayed as web
page on the browser.
● Eg: Apache, Microsoft IIS and Netscape.
● Web pages are written using different HTML tags and viewed in browser window.
● The different browsers and their versions greatly affect the way a page is rendered, as
different browsers sometimes interpret same HTML tag in a different way.
● Different versions of HTML also support different sets of tags.
● The support for different tags also varies across the different browsers and their versions.
● Same browser may work slightly different on different operating system and hardware
platform.
● To make a web page portable, test it on different browsers on different operating systems.
Bandwidth and Cache
● Users have different connection speed, i.e. bandwidth, to access the Web sites.
● Connection speed plays an important role in designing web pages, if user has low
bandwidth connection and a web page contains too many images, it takes more time to
download.
● Generally, users have no patience to wait for longer time than 10-15 seconds and move to
other site without looking at contents of your web page.
● Browser provides temporary memory called cache to store the graphics.
● When user gives the URL of the web page for the first time, HTML file together with all
the graphics files referred in a page is downloaded and displayed.
Display Resolution
● Display resolution is another important factor affecting the Web page design, as we do
not have any control on display resolution of the monitors on which user views our pages.
● Display or screen resolution is measured in terms of pixels and common resolutions are
800 X 600 and 1024 X 786.
● We have three choices for Web page design.
o Design a web page with fixed resolution.
o Make a flexible design using HTML table to fit into different resolution.
o If the page is displayed on a monitor with a higher resolution, the page is
displayed on left-hand side and some part on the right-hand side remains blank.
We can use centered design to display page properly.
Look & Feel
● Look and feel of the website decides the overall appearance of the website.
● It includes all the design aspects such as
● Web site theme
● Web typography
● Graphics
● Visual structure
● Navigation etc…
● Website contains of individual web pages that are linked together using various
navigational links.
● Page layout defines the visual structure of the page and divides the page area into
different parts to present the information of varying importance.
● Page layout allows the designer to distribute the contents on a page such that visitor can
view it easily and find necessary details.
Locating Information
● Webpage is viewed on a computer screen and the screen can be divided into five major
areas such as center, top, right, bottom and left in this particular order.
● The first major area of importance in terms of users viewing pattern is the center, then
top, right, bottom and left in this particular order.
Making Design user-Centric
● It is very difficult for any Web designer to predict the exact behavior of the Web site
users.
● general behavior of common user helps in making design of the Web site user-centric.
● Users either scan the information on the web page to find the section of their interest or
read the information to get details.
Sitemap
● Web sites are too complex as there are a large number of sections and each section
contains many pages.
● It becomes difficult for visitors to quickly move from one part to other.
● Once the user selects a particular section and pages in that section, user gets confused
about where he/she is and where to go from there.
● To make it simple, keep your hierarchy of information to few levels or provide the
navigation bar on each page to jump directly to a particular section.
What is HTML?
● Stands for Hypertext Markup Language.
● Most documents that appear on the World Wide Web were written in HTML.
● HTML is a markup language, not a programming language.
● HTML stands for Hypertext Markup Language.
● This markup language can be applied to the pages to display text, images, sound and
movie files, and almost any other type of electronic information.
● The language can be used to format documents and link them together.
HTML Elements/Tags
● A web browser reads an HTML document top to bottom, left to right.
● Each time the browser finds a tag, it is displayed accordingly (paragraphs look like
paragraphs, tables look like tables, etc).
● Tags have 3 major parts: opening tag(s), content(s), and closing tag(s).
● Eg:
<p> //opening paragraph tag
2. <head> Element
● The <head> element is "next" to <html> tag.
● Placed between <html> tag and web page content (<body>).
● The head functions "behind the scenes." Tags placed within the head element are
not directly displayed by web browsers.
● Other elements used for scripting (JavaScript) and formatting (CSS) such as
<title>, <style>, <link>,<script> elements etc. will be placed inside <head>
section.
● Eg:
<html>
<head>
……………………..
</head>
</html>
3. The <title> Element
● <title> tag is placed within the <head> element.
● Used to title your page.
● The words you write between the opening and closing <title>…</title> tags will
be displayed at the top of a viewer's browser.
● Eg:
<html><head><title>My WebPage</title></head></html>
<html>
<head>
<title>My WebPage!</title>
</head>
<body>
<p>This is a paragraph.
</p>
</body>
</html>
Output:
<html>
<head>
<title>My WebPage!</title>
</head>
<body>
<p>
</p>
</body>
</html>
Output:
This is a paragraph
3. Headings (1:6)
● A heading in HTML is to include a title or subtitle inside the body tag.
● By placing text inside of <h1> (heading) tags, the text displays bold and the size of
the text depends on the number of heading (1-6).
● Headings are numbered 1-6, with H1 being the largest heading and H6 being the
smallest.
● Eg
HTML Code:
<html>
<head>
<title>My WebPage!</title>
</head>
<body>
<h1>This is heading 1</h1> <br>
<h2>This is heading 2</h2> <br>
<h3>This is heading 3</h3> <br>
<h4>This is heading 4</h4> <br>
<h5>This is heading 5</h5> <br>
<h6>This is heading 6</h6> <br>
</body>
</html>
Output
This is heading 1
This is heading 1
This is heading 1
This is heading 1
This is heading 1
This is heading 1
HTML Code:
<html>
<head>
<title>My WebPage!</title>
</head>
<body>
<p>
<pre>
This is a paragraph
Hello World
</pre>
</p>
</body>
</html>
Output:
This is a paragraph
Hello World
6. Font Tag
The <font> tag is used to add style, size, and color to the text on your site.
6a.Color
● There are 2 different methods to set color.
a. Using color name
<font color=”red”>
b. Using Hexadecimal value
<font color=”#ffff00”>
● To set Background color
o Use bgcolor attribute inside <body> tag
o Syntax:
<body bgcolor=”red”>
<body bgcolor=”#FF0000>
Eg:
HTML Code:
<html>
<head>
<title>My WebPage!</title>
</head>
<body bgcolor=”green”> //to set background color
<font color=”#FF0000”> //make all txt inside body to red color
<p>
</p>
</font>
</body>
</html>
Output:
Eg:
HTML Code:
<html>
<head>
<title>My WebPage!</title>
</head>
<body bgcolor=”green”>
<p>
</font>
</p>
</body>
</html>
Output:
7. Alignment
HTML Code:
<html>
<head>
<title>My WebPage!</title>
</head>
<body bgcolor=”green”>
<p align=”center”>This is a text aligned center.</p>
</body>
</html>
Output:
● Images as links
Eg:<a href=”http://www.domainname.com”><img src=”cats.jpg”></a>
Eg:
<a href=”http://www.domainname.com”><img src=”cats.jpg” alt=”Html Image
link”></a>
o alt attribute is used as alternate text if the image cannot be displayed.
● To open the link page on a new window
Eg:
<a href=”http://www.domainname.com” target=”_blank”>click here</a>
o The target attribute specifies where to open the linked document.
o The target attribute can have one of the following values:
▪ _blank - Opens the linked document in a new window or tab
▪ _self - Opens the linked document in the same window/tab as it was
clicked (this is default)
▪ _parent - Opens the linked document in the parent frame
▪ _top - Opens the linked document in the full body of the window
▪ framename - Opens the linked document in a named frame
…..
<a href=#top”>back to top</a> //link
</body>
</html>
● Form a link from another page to an anchored point.
● Eg:
● Reference sub directories under the current working directory using links
● Eg:
<a href=”text/trial.html”>click here</a>
● You are in sub directory and want to link into file above that, then use
two dots(..)
● Eg:
<a href=”../pics/picture.jpg”>click here</a>
● Eg:
<html>
<head>
</head>
<body>
</p>
</p>
</p>
</body>
</html>
10.HTML Lists
● There are 3 different types of lists.
1. <ul> - unordered list; bullets
2. <ol> - ordered list; numbers
3. <dl> - definition list; dictionary
3.Milk
● Start your ordered list on any number besides 1 using the start attribute.
HTML Code:
<html>
<body>
<ol start=”4”>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
Output:
4.Coffee
5.Tea
6.Milk
<ol type="a">
<ol type="A">
<ol type="i">
<ol type="I">
<ul>
<li>Milk</li>
<li>Chocolate</li>
</ul>
HTML Code:
<html>
<body>
<h2>An ordered HTML List</h2>
<ul >
<li>Coffee</li>
<li>Tea</li>
</ul>
</body>
</html>
Output:
● Coffee
● Tea
A Description List
Coffee
- black hot drink
Milk
- white cold drink
10d.HTML Nested Lists
<html>
<body>
<h2>An Unordered HTML List</h2>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<h2>An Ordered HTML List</h2>
<ol type=”a”>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
Output
<table border="1">
Syntax:
<html><body>
<table >
<tr>
<td>first row column item 1</td>
<td> first row column item 2</td>
</tr>
<tr>
<td>second row column item 1</td>
<td> second row column item 2</td>
</tr>
</table>
</body>
</html>
Eg:
Html Code:
<html>
<body>
<table border="10">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
</body></html>
Output:
Jill Smith 50
Eve Jackson 94
Table headers
● Table heading is provided using <th> and </th> inside each row <tr> nad </tr>tags.
Eg:
Html Code:
<html>
<body>
<table border="10">
<tr>
<th>First Name</th>
<th>Second Name</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
</body>
</html>
Output:
● With the cellpadding and cellspacing attributes is used to adjust the white space on the
tables.
● Cell Spacing defines the space between the cells.
● Cell padding represents the distance between cell borders and the content within.
● Syntax:
<table border="1" cellspacing="10" cellspacing=”5”>
Width
Align
</table></body>
</html>
Output
Irregular Tables
● Cell can span across more than one row or column.
● Use rowspan to span multiple rows and colspan to span multiple columns.
● Eg:
Html Code:
<html>
<body>
<table border="1">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th></tr>
<tr>
<tr>
</tr>
</table></body></html>
</body>
</html>
● Name:
o The name attribute specifies the name of a form which is used to reference
elements in a JavaScript.
● Action:
o The action attribute specifies where to send the form-data when a form is
submitted.
● Method :
o The method attribute specifies how to send form-
o <form method="get|post">
o Value : get
▪ Default. Appends the form-data to the URL.not good for sending sensitive
data.
o Value : post
▪ Appends data inside an HTTP request and sends as HTTP post transaction.
Making a Form
<input> Element
Eg:
Name of input
Types of Input
● The main tag for collecting information from the user is <input>.
● The tag contains a name attribute, so that we can refer to the input by a name, and the
size of the entry box in characters.
● Different types of input to choose from:
Textbox
o <input type=”text”/>
o this is the default input type and accepts characters and numbers into a text box.
o value attribute attached to it, which will give it an initial value.
Password
● <input type=”password”/>
● this is similar to the above text box but anything that is typed cannot be seen;
instead an asterisk is printed to cover up the entry. This is used for password
entry.
Checkbox
● <input type=”checkbox”/>
● gives a box that can be toggled between checked and unchecked.
● It can initially be set to one or the other with checked=”checked”.
Radio Button
● <input type=”radio”/>
● this is similar to checkbox but in group of radio buttons only one can be
selected at a time.
Button
● <input type=”button”/>
● this makes a button available.
File
● <input type=”file”/>
● This will give a box to allow you to choose a file
Submit
● <input type=”submit”/>
● this allows a form to be submitted.
● When pressed, the information will be passed on for processing, usually to a
script mentioned in the action attribute option of the form.
Image
● <input type=”image”/>
● this will also submit the form when selected and, like the img tag, requires the
src attribute to specify an associated image.
Reset
● <input type=”reset”/>
● this will reset the form to its initial state when selected.
Hidden
● <input type=”hidden”/>
● this allows hidden data to be passed along with the form.
Examples
Eg1:
Html Code:
<html>
<body>
</form>
</body>
</html>
Output
Name
Password
Eg2:
<html>
<body>
<form action="/action_page.php">
First name:<br>
<br>
Last name:<br>
<br><br>
</form>
</body>
</html>
Output:
FirstName
Second Name
Eg3:
Html Code:
<html>
<body>
</form>
</body>
</html>
Output
o blue
ʘ red
Eg4:
Html Code:
<html>
<body>
</form>
</body>
</html>
Output
☑ Tom
Donald
o Drop down menus are created with the <select> and <option> tags.
o <select> is the list itself and each <option> is an available choice for the user.
o Eg:
Html Code:
<html>
<body>
<select name="degree">
<option>Choose One</option>
<option>High School</option>
<option>Degree</option>
</form>
</body>
</html>
o the selected option tells the browser which choice to select by default.
Html Code:
<html>
<body>
<select name="degree">
<option>Choose One</option>
<option>Degree</option>
</form>
</body>
</html>
o Text areas serve as an input field for viewers to place their own comments onto forums.
o Rows and columns need to be specified as attributes to the <textarea> tag.
Html Code
<html>
<body>
</textarea>
</form>
</body>
</html>
Output
XHTML
What is XHTML?
XHTML Elements
Eg:
<body>
<p>This is a paragraph</p>
</body>
XHTML Attributes
● Attribute names must be in lower case
● Attribute values must be quoted
Eg: <table width="100%">
Syntax:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML1.0 Strict/EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
Frameset
Syntax:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML1.0 Frameset/EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”>
Basic XHTML
Syntax:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML1.0 Basic/EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-basic.dtd”>
Example
<?xml version=”1.0”?>
<head>
<title></title>
</head>
<body>
Hello world
</body>
</html>
DTD
● Document Type Definition
● Defines document structure with list of legal elements and attributes
Namespace
META TAGS
● Metadata is machine understandable information about web resources.
● Used to describe the actual document rather than document’s content.
● Meta data is included in head section of page.
● this will not be displayed on the page.
● Different meta tags are:
o <meta name=”keywords” content=”html,css,xml,xhtml,javascript”>
▪ Defines keywords for search engines
o <meta name=”description” content=”web tutorial”>
▪ Defines a description for our webpage
o <meta name=”author” content=”helen”>
▪ Defines author of the page
o <meta name=”refresh” content=”50”; http://mysite.com/mysite.html>
▪ This will cause page to be refreshed after 50seonds and a redirection to
occur to the url specified.
o <meta http-equiv=”refresh” content=”30”>
▪ Efreshes the document every 30seconds
o <meta charset=”UTF-8”>
▪ Specifes character encoding for the document
o <meta http-equiv=”pragma” content=”no-cache”>
▪ Stops from caching a page
o <meta scheme=”USA” name=”date” content=”10-1-1995”>
▪ Give a content for dat such as date or time
Character Entities
It is used to tell someone about html code.
<?xml version=”1.0”?>
<head>
<title></title>
</head>
<body>
</body>
</html>
Rows
Divide page into rows and to place a new page into each frame.
<html>
<head>
</head>
<frameset rows=”20,*,40”>
</frameset>
Columns
Divide page into columns and to place a new page into each frame.
<html>
<head>
</head>
<frameset cols=”20,*,40”>
</frameset>
Divide page into columns and rows and to place a new page into each frame.
<html>
<head>
</head>
</frameset>
Output
b.html c.html
d.html b.html
c.html d.html
Eg2:
html>
<head>
</head>
</frameset>
</frameset>
Output
c.html
b.html
d.html
Inline Frames
<html>
</iframe>
</html>
What is CSS?
CSS stands for Cascading Style Sheets
CSS Syntax
A CSS rule has two main parts:
o a selector
o The selector is normally the HTML element you want to style.
o one or more declarations
o Each declaration consists of a property and a value.
o The property is the style attribute you want to change. Each property has a value.
● Syntax
Selector
{
property1: value;
}
● Example
● If you want to set multiple property to same element separate using semicolons
Example:
p
{
color:blue;
font-size:10;
}
● Several selectors can have same property using commas.
Eg:
p,h1,h2,h3
{
color:blue;
font-size:10;
}
● by tag
● by class
● by id
Tag selector
<html>
<head>
<style>
p
{
color:blue;
font-size:10;
}
</style>
</head>
<body>
</body>
</html>
The id Selector
The id selector is used to specify a style for a single, unique element.
The id selector uses the id attribute of the HTML element, and is defined with a "#".
Example:
The style rule below will be applied to any element with id="para1":
<html>
<head>
<style>
#para1
text-align:center;
color:red;
</style>
</head>
<body>
</body>
</html>
Example:
The style rule below will be applied to an identified element with id="para1":
<html>
<head>
<style>
p#para1
text-align:center;
color:red;
</style>
</head>
<body>
</body>
</html>
<html>
<head>
<style>
.center
text-align:center;
</style>
</head>
<body>
</body>
</html>
Eg2:
<html>
<head>
<style>
p.center
text-align:center;
color:red;
</style>
</head>
<body>
</body>
</html>
● External CSS is a file that contains only CSS code and is saved with a ".css" file
extension.
● This CSS file is then referenced in your HTML using the <link> instead of <style>.
<link rel="stylesheet" type="text/css" href="test.css" />
● rel-specifies relationship between current dcumnet and linked document
● type-type of document to be linked.
● Useful if your website contains large number of webpages.
● Example
Test.css file
body
{
background-color: gray;
color: blue;
Trialcss.html file
<html>
<head>
</head>
<body>
Internal/Embedded CSS
● This type of CSS is used to apply style only for Single Page.
● When using internal CSS, we must add a tag, <style>, inside the <head> tag.
● Example
<html>
<head>
<style type="text/css">
p {color: white; }
</style>
</head>
<body>
</body>
</html>
Inline CSS
<html>
<head>
</head>
<body>
</body>
</html>
CSS background properties are used to define the background effects of an element.
body {background-color:#FF0000;} or
body {background:#FF0000;} or
body {background:red;}
● You can have a background image repeat vertically (y-axis), horizontally (x-axis), in both
directions, or in neither direction.
● Example
CSS font properties define the font family, boldness, size, and the style of a text.
MANIPULATING TEXT
● CSS Text allows you to control the spacing, decoration, and alignment of your text.
h4 { color: red; }
h5 { color: #9000A1; }
2. Text Decoration
a { text-decoration: none; }
3. Text Indentation
● The text-indentation property is used to specify the indentation of the first line
of a text.
● p { text-indent: 20px; }
● h5 { text-indent: 30%; }
4.Text Align
5.Text Transform
● The text-transform property is used to specify uppercase and lowercase letters in a text.
● p { text-transform: uppercase; }
● h5{ text-transform: lowercase; }
● h1{ text-transform: capitalize; }
2.Border Width
3.Border Color
4.Border: border-(direction)
BOX MODEL
● The CSS box model is essentially a box that wraps around HTML elements, and it
consists of:
o margins, borders, padding, and the actual content.
● The box model allows us to place a border around elements and space elements in
relation to other elements.
● Margin - Clears an area around the border. The margin does not have a background color,
it is completely transparent.
● Border - A border that goes around the padding and content. The border is affected by the
background color of the box
● Padding - space between content and border.padding is affected by the background color
of the box
● Content - The content of the box, where text and images appear.
CSS PADDING
● The CSS padding properties define the space between the element border and the element
content.
● The top, right, bottom, and left padding can be changed independently using separate
properties.
● Possible Values
padding:25px 50px;
padding-top:25px;
padding-bottom:25px;
padding-right:50px;
padding-left:50px;
CSS MARGIN
● The CSS margin properties define the space around elements.
● Eg:
● p {margin: 5px; }
margin-top:100px;
margin-bottom:100px;
margin-right:50px;
margin-left:50px;
CSS LISTS
● The CSS list properties allow you to:
● Set different list item markers for ordered lists
● Set different list item markers for unordered lists
● Set an image as the list item marker
ol { list-style-type: upper-roman; }
ul { list-style-type: circle; }
Example:
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:underline;}
Example
POSITIONING CSS
● to manipulate the exact position of your HTML elements.
● Position Relative
o Relative positioning changes the position of the HTML element
relative to where it normally appears.
o Eg: If we had a header that appears at the top of our page, we could
use relative positioning to move it a bit to the right and down a couple
of pixels.
h3 {
position: relative;
top: 15px;
left: 150px;
● Position Absolute
o With absolute positioning, you define the exact pixel value where the
specified HTML element will appear.
h3 {
position: absolute;
top: 50px;
left: 45px;
z-index property
● CSS allows you to control which item will appear on top with the use of layers.
● In CSS, each element is given a priority.
● If there are two overlapping CSS positioned elements, the element with the higher priority
will appear on top of the other.
● To manually define a priority, set the z-index value. The larger the value, the higher the
priority the element will have.
● Eg:<html><head><style>
h4{
position: relative;
top: 30px;
left: 50px;
z-index: 2;
}
p{
position: relative;
top: 30px;
left: 50px;
z-index: 1;
}
</style></head>
<body>
<p>llllll</p>
<h1>kkkk</h1>
</body>
</html>
If we had not defined the z-index, by default the paragraph would have been on top of the header
<body>
</body>
<div> Tag
● Defines a division or a section in an html document.
Example:
<head>
<style>
div
display:block;
</style>
</head>
<body>
<div>