Professional Documents
Culture Documents
Unit 1 Wad
Unit 1 Wad
What is Internet?
The Internet is essentially a global network of computing resources. You can think of the Internet as
a physical collection of routers and circuits as a set of shared resources.
Some common definitions given in the past include −
Internet-Based Services
What is WWW?
WWW stands for World Wide Web. A technical definition of the World Wide Web is − All the
resources and users on the Internet that are using the Hypertext Transfer Protocol (HTTP).
A broader definition comes from the organization that Web inventor Tim Berners-Lee helped found,
the World Wide Web Consortium (W3C): The World Wide Web is the universe of network-accessible
information, an embodiment of human knowledge.
In simple terms, The World Wide Web is a way of exchanging information between computers on the
Internet, tying them together into a vast collection of interactive multimedia resources.
What is HTTP?
HTTP stands for Hypertext Transfer Protocol. This is the protocol being used to transfer hypertext
documents that makes the World Wide Web possible.
A standard web address such as Yahoo.com is called a URL and here the prefix http indicates its
protocol
What is URL?
URL stands for Uniform Resource Locator, and is used to specify addresses on the World Wide
Web. A URL is the fundamental network identification for any resource connected to the web (e.g.,
hypertext pages, images, and sound files).
A URL will have the following format −
protocol://hostname/other_information
The protocol specifies how information is transferred from a link. The protocol used for web
resources is HyperText Transfer Protocol (HTTP). Other protocols compatible with most web
browsers include FTP, telnet, newsgroups, and Gopher.
The protocol is followed by a colon, two slashes, and then the domain name. The domain name is
the computer on which the resource is located.
Links to particular files or subdirectories may be further specified after the domain name. The
directory names are separated by single forward slashes.
What is Website?
Every Website sits on a computer known as a Web server. This server is always connected to the
internet. Every Web server that is connected to the Internet is given a unique address made up of a
series of four numbers between 0 and 256 separated by periods. For example, 68.178.157.132 or
68.122.35.127.
When you register a Web address, also known as a domain name, such as tutorialspoint.com you
have to specify the IP address of the Web server that will host the site.
We will see different type of Web servers in a separate chapter.
Web Browsers are software installed on your PC. To access the Web you need a web browsers,
such as Netscape Navigator, Microsoft Internet Explorer or Mozilla Firefox.
Currently you must be using any sort of Web browser while you are navigating through my site
tutorialspoint.com. On the Web, when you navigate through pages of information this is commonly
known as browsing or surfing.
We will see different type of Web browsers in a separate chapter.
SMTP stands for Simple Mail Transfer Protocol Server. This server takes care of delivering emails
from one server to another server. When you send an email to an email address, it is delivered to its
recipient by a SMTP Server.
What is ISP?
ISP stands for Internet Service Provider. They are the companies who provide you service in terms
of internet connection to connect to the internet.
You will buy space on a Web Server from any Internet Service Provider. This space will be used to
host your Website.
What is HTML?
HTML stands for Hyper Text Markup Language. This is the language in which we write web pages
for any Website. Even the page you are reading right now is written in HTML.
This is a subset of Standard Generalized Mark-Up Language (SGML) for electronic publishing, the
specific standard used for the World Wide Web.
What is Hyperlink?
What is DNS?
What is W3C?
When you enter something like Google.com the request goes to one of many special computers on
the Internet known as Domain Name Servers (DNS). All these requests are routed through various
routers and switches. The domain name servers keep tables of machine names and their IP
addresses, so when you type in Google.com it gets translated into a number, which identifies the
computers that serve the Google Website to you.
When you want to view any page on the Web, you must initiate the activity by requesting a page
using your browser. The browser asks a domain name server to translate the domain name you
requested into an IP address. The browser then sends a request to that server for the page you
want, using a standard called Hypertext Transfer Protocol or HTTP.
The server should constantly be connected to the Internet, ready to serve pages to visitors. When it
receives a request, it looks for the requested document and returns it to the Web browser. When a
request is made, the server usually logs the client's IP address, the document requested, and the
date and time it was requested. This information varies server to server.
An average Web page actually requires the Web browser to request more than one file from the
Web server and not just the HTML / XHTML page, but also any images, style sheets, and other
resources used in the web page. Each of these files including the main page needs a URL to identify
each item. Then each item is sent by the Web server to the Web browser and Web browser collects
all this information and displays them in the form of Web page.
In Short
We have seen how a Web client - server interaction happens. We can summarize these steps as
follows −
A user enters a URL into a browser (for example, Google.com. This request is passed to a domain
name server.
The domain name server returns an IP address for the server that hosts the Website (for example,
68.178.157.132).
The browser requests the page from the Web server using the IP address specified by the domain
name server.
The Web server returns the page to the IP address specified by the browser requesting the page.
The page may also contain links to other files on the same server, such as images, which the
browser will also request.
The browser collects all the information and displays to your computer in the form of Web page.
Internet Explorer
Internet Explorer (IE) is a product from software giant Microsoft. This is the most commonly used
browser in the universe. This was introduced in 1995 along with Windows 95 launch and it has
passed Netscape popularity in 1998.
You can download a latest version of this browser by clicking here → Download Internet Explorer
Google Chrome
This web browser is developed by Google and its beta version was first released on September 2,
2008 for Microsoft Windows. Today, chrome is known to be one of the most popular web browser
with its global share of more than 50%.
You can download a latest version of this browser by clicking here → Download Google Chrome
Mozilla Firefox
Firefox is a new browser derived from Mozilla. It was released in 2004 and has grown to be the
second most popular browser on the Internet.
You can download a latest version of this browser by clicking here → Download Firefox
Safari
Safari is a web browser developed by Apple Inc. and included in Mac OS X. It was first released as a
public beta in January 2003. Safari has very good support for latest technologies like XHTML, CSS2
etc.
You can download a latest version of this browser by clicking here → Download Safari
Opera
Opera is smaller and faster than most other browsers, yet it is full- featured. Fast, user-friendly, with
keyboard interface, multiple windows, zoom functions, and more. Java and non Java-enabled
versions available. Ideal for newcomers to the Internet, school children, handicap and as a front-end
for CD-Rom and kiosks.
You can download a latest version of this browser by clicking here → Download Opera
Konqueror
Konqueror is an Open Source web browser with HTML 4.01 compliance, supporting Java applets,
JavaScript, CSS 1, CSS 2.1, as well as Netscape plugins. This works as a file manager as well as it
supports basic file management on local UNIX filesystems, from simple cut/copy and paste
operations to advanced remote and local network file browsing.
You can download a latest version of this browser by clicking here → Download Konqueror
Lynx
Lynx is a fully-featured World Wide Web browser for users on Unix, VMS, and other platforms
running cursor-addressable, character-cell terminals or emulators.
You can download a latest version of this browser by clicking here → Download Lynx
This is the most popular web server in the world developed by the Apache Software Foundation.
Apache web server is an open source software and can be installed on almost all operating systems
including Linux, Unix, Windows, FreeBSD, Mac OS X and more. About 60% of the web server
machines run the Apache Web Server.
You can have Apache with tomcat module to have JSP and J2EE related support.
You can have detailed information about this server at Apache HTTP Server
The Internet Information Server (IIS) is a high performance Web Server from Microsoft. This web
server runs on Windows NT/2000 and 2003 platforms ( and may be on upcoming new Windows
version also). IIS comes bundled with Windows NT/2000 and 2003; Because IIS is tightly integrated
with the operating system so it is relatively easy to administer it.
You can have detailed information about this server at Miscrosoft IIS
lighttpd
The lighttpd, pronounced lighty is also a free web server that is distributed with the FreeBSD
operating system. This open source web server is fast, secure and consumes much less CPU power.
Lighttpd can also run on Windows, Mac OS X, Linux and Solaris operating systems.
You can have detailed information about this server at lighttpd
This web server from Sun Microsystems is suited for medium and large websites. Though the server
is free it is not open source. It however, runs on Windows, Linux and Unix platforms. The Sun Java
System web server supports various languages, scripts and technologies required for Web 2.0 such
as JSP, Java Servlets, PHP, Perl, Python, Ruby on Rails, ASP and Coldfusion etc.
You can have detailed information about this server at Sun Java System Web Server
Jigsaw Server
Jigsaw (W3C's Server) comes from the World Wide Web Consortium. It is open source and free and
can run on various platforms like Linux, Unix, Windows, Mac OS X Free BSD etc. Jigsaw has been
written in Java and can run CGI scripts and PHP programs.
You can have detailed information about this server at Jigsaw Server
HTML Basic Examples
In this chapter we will show some basic HTML examples.
Don't worry if we use tags you have not learned about yet.
HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE html>.
Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
It must only appear once, at the top of the page (before any HTML tags).
<!DOCTYPE html>
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
Example
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
HTML Paragraphs
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
Try it Yourself »
HTML Links
Example
<a href="https://www.w3schools.com">This is a link</a>
Try it Yourself »
The link's destination is specified in the href attribute.
HTML Images
Example
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">
Try it Yourself »
HTML Elements
The HTML element is everything from the start tag to the end tag:
HTML Attributes
HTML Attributes
The <a> tag defines a hyperlink. The href attribute specifies the URL of the page the link
goes to:
Example
<a href="https://www.w3schools.com">Visit W3Schools</a>
Try it Yourself »
Example
<img src="img_girl.jpg">
Try it Yourself »
Notes: External images might be under copyright. If you do not get permission to use
it, you may be in violation of copyright laws. In addition, you cannot control external
images; it can suddenly be removed or changed.
2. Relative URL - Links to an image that is hosted within the website. Here, the URL
does not include the domain name. If the URL begins without a slash, it will be relative
to the current page. Example: src="img_girl.jpg". If the URL begins with a slash, it will
be relative to the domain. Example: src="/images/img_girl.jpg".
Tip: It is almost always best to use relative URLs. They will not break if you change
domain.
Example
<img src="img_girl.jpg" width="500" height="600">
Try it Yourself »
Try it Yourself »
Example
See what happens if we try to display an image that does not exist:
Try it Yourself »
The style attribute is used to add styles to an element, such as color, font, size, and
more.
Example
<p style="color:red;">This is a red paragraph.</p>
Try it Yourself »
HTML Form Attributes
This chapter describes the different attributes for the HTML <form> element.
Usually, the form data is sent to a file on the server when the user clicks on the submit
button.
In the example below, the form data is sent to a file called "action_page.php". This file
contains a server-side script that handles the form data:
Example
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
Try it Yourself »
The method attribute specifies the HTTP method to be used when submitting the form
data.
Example
This example uses the GET method when submitting the form data:
<form action="/action_page.php" method="get">
Try it Yourself »
Example
This example uses the POST method when submitting the form data:
<form action="/action_page.php" method="post">
Try it Yourself »
HTML Comments
HTML comments are not displayed in the browser, but they can help document your
HTML source code.
Notice that there is an exclamation point (!) in the start tag, but not in the end tag.
Note: Comments are not displayed by the browser, but they can help document your HTML
source code.
With comments you can place notifications and reminders in your HTML code:
Example
<!-- This is a comment -->
<p>This is a paragraph.</p>
HTML form elements are used to capture user input. There are many different types of form elements
such as the text box, check box, drop down, submit button, and much more.
The form elements above are the most common used form elements. We will go into further detail on
each of these form elements:
The text box input is used to capture text such as a name, email, address, or any other type of text.
To create an HTML text box we will use the input tag and specify that the type attribute to be text.
Notice the name attribute. This is the name that will be sent to the server when the form is submitted, so
our server side code would get this text box value by referencing the first_name form element.
Let's take another quick example of how a text box looks in HTML:
Notice we have text above the text box which says First Name, this is referred to as a label and is a
way of describing what the user should input in the form element. A basic HTML label will look like
the following:
<label> tags are very common when using HTML forms. Notice the for attribute contains the
value first_name this matches the name of your input. So since our input has a name
of name="first_name" our label will have an attribute of for="first_name". Easy Peasy, right. Let's
move on to the password input.
Password Input
The password input is essentially the same thing as the Text Box input; however, it does not show the
text as the user types. Try it out in the example below:
Text Area
To create a Text Area where a large amount of text can be entered by the user we can use
the <textarea> tag. Take a look at an example of how to create a Text Area in HTML:
<textarea name="comment"></textarea>
A Drop Down is a specific list of options that a user can choose when selecting a Drop Down menu.
To create a Select Dropdown in HTML you would represent this inside of <select></select> tags,
then each option that you want to allow your user, you will specify with an <option></option> tag
inside the select tags. Take a look at the following example:
<select name="weapon">
<option value="sword">Sword</option>
<option value="staff">Staff</option>
</select>
Check Box
A check box is exactly what it sounds like, it's a box that you can click and it can be checked or
unchecked. When the check box is checked you are setting the check box to true. Otherwise if it is
unchecked you are saying that it is false. Take a look at how we can create an HTML check box below:
Radio Input
A radio select input allows a user a specific amount of options to select from. You can think of this like
a multiple choice select. The user can only select one of the options. Take a look at how to create
Radio Select Inputs in HTML:
If you wish to have one of your radio buttons selected by default you can add a checked attribute to
the element like so:
File Input
A File input is used to allow users to upload images or files. To create a File input element we will use
the input element and give it a type of file like the following:
When clicking on the Choose File button above the user will then be prompted with a window to
specify which file they would like to upload.
Submit Button
Lastly we are going to need a way to submit our form with all the data. This is what the submit button
is used for. In order to use the submit button we will use another input element with
a type of submit:
Example
An HTML form with an input field that can contain only three letters (no numbers or special
characters):
<form action="/action_page.php">
<label for="country_code">Country code:</label>
<input type="text" id="country_code" name="country_code"
pattern="[A-Za-z]{3}" title="Three letter country code"><br><br>
<input type="submit">
</form>
Try it Yourself »
MORE EXAMPLES
CSS Introduction
CSS is the language we use to style a Web page.
What is CSS?
CSS stands for Cascading Style Sheets
CSS describes how HTML elements are to be displayed on screen, paper, or in other
media
CSS saves a lot of work. It can control the layout of multiple web pages all at once
External stylesheets are stored in CSS files
CSS Syntax
A CSS rule consists of a selector and a declaration block.
CSS Syntax
Each declaration includes a CSS property name and a value, separated by a colon.
Multiple CSS declarations are separated with semicolons, and declaration blocks are
surrounded by curly braces.
Example
In this example all <p> elements will be center-aligned, with a red text color:
p {
color: red;
text-align: center;
}
CSS Selectors
A CSS selector selects the HTML element(s) you want to style.
CSS Selectors
CSS selectors are used to "find" (or select) the HTML elements you want to style.
Example
Here, all <p> elements on the page will be center-aligned, with a red text color:
p {
text-align: center;
color: red;
}
The CSS id Selector
The id selector uses the id attribute of an HTML element to select a specific element.
The id of an element is unique within a page, so the id selector is used to select one unique
element!
To select an element with a specific id, write a hash (#) character, followed by the id of the
element.
Example
The CSS rule below will be applied to the HTML element with id="para1":
#para1 {
text-align: center;
color: red;
}
Try it Yourself »
To select elements with a specific class, write a period (.) character, followed by the class
name.
Example
In this example all HTML elements with class="center" will be red and center-aligned:
.center {
text-align: center;
color: red;
}
Try it Yourself »
You can also specify that only specific HTML elements should be affected by a class.
Example
In this example only <p> elements with class="center" will be red and center-aligned:
p.center {
text-align: center;
color: red;
}
Try it Yourself »
Example
In this example the <p> element will be styled according to class="center" and to
class="large":
Try it Yourself »
Example
The CSS rule below will affect every HTML element on the page:
* {
text-align: center;
color: blue;
}
Try it Yourself »
Look at the following CSS code (the h1, h2, and p elements have the same style
definitions):
h1 {
text-align: center;
color: red;
}
h2 {
text-align: center;
color: red;
}
p {
text-align: center;
color: red;
}
Example
In this example we have grouped the selectors from the code above:
HTML Styles - CSS
CSS stands for Cascading Style Sheets.
CSS saves a lot of work. It can control the layout of multiple web pages all at once.
C o l o r s , B o x e s
What is CSS?
Cascading Style Sheets (CSS) is used to format the layout of a webpage.
With CSS, you can control the color, font, the size of text, the spacing between elements,
how elements are positioned and laid out, what background images or background colors
are to be used, different displays for different devices and screen sizes, and much more!
Tip: The word cascading means that a style applied to a parent element will also apply to
all children elements within the parent. So, if you set the color of the body text to "blue", all
headings, paragraphs, and other text elements within the body will also get the same color
(unless you specify something else)!
Using CSS
CSS can be added to HTML documents in 3 ways:
The most common way to add CSS, is to keep the styles in external CSS files. However, in
this tutorial we will use inline and internal styles, because this is easier to demonstrate, and
easier for you to try it yourself.
Inline CSS
An inline CSS is used to apply a unique style to a single HTML element.
The following example sets the text color of the <h1> element to blue, and the text color of
the <p> element to red:
Example
<h1 style="color:blue;">A Blue Heading</h1>
Try it Yourself »
Internal CSS
An internal CSS is used to define a style for a single HTML page.
Example
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
External CSS
An external style sheet is used to define the style for many HTML pages.
To use an external style sheet, add a link to it in the <head> section of each HTML page:
Example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Try it Yourself »
The external style sheet can be written in any text editor. The file must not contain any
HTML code, and must be saved with a .css extension.
"styles.css":
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p {
color: red;
}
Tip: With an external style sheet, you can change the look of an entire web site, by
changing one file!
Example
Use of CSS color, font-family and font-size properties:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: blue;
font-family: verdana;
font-size: 300%;
}
p {
color: red;
font-family: courier;
font-size: 160%;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Try it Yourself »
CSS Border
The CSS border property defines a border around an HTML element.
Example
Use of CSS border property:
p {
border: 2px solid powderblue;
}
Try it Yourself »
CSS Padding
The CSS padding property defines a padding (space) between the text and the border.
Example
Use of CSS border and padding properties:
p {
border: 2px solid powderblue;
padding: 30px;
}
Try it Yourself »
CSS Margin
The CSS margin property defines a margin (space) outside the border.
Example
Use of CSS border and margin properties:
p {
border: 2px solid powderblue;
margin: 50px;
}
Try it Yourself »
Example
This example uses a full URL to link to a style sheet:
<link rel="stylesheet" href="https://www.w3schools.com/html/styles.css">
Try it Yourself »
Example
This example links to a style sheet located in the html folder on the current web site:
<link rel="stylesheet" href="/html/styles.css">
Try it Yourself »
Example
This example links to a style sheet located in the same folder as the current page:
<link rel="stylesheet" href="styles.css">
CSS Box Model
All HTML elements can be considered as boxes.
The CSS box model is essentially a box that wraps around every HTML element. It consists
of: margins, borders, padding, and the actual content. The image below illustrates the box
model:
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
The box model allows us to add a border around elements, and to define space between
elements.
Example
Demonstration of the box model:
div {
width: 300px;
border: 15px solid green;
padding: 50px;
margin: 20px;
}
Try it Yourself »
Important: When you set the width and height properties of an element with CSS, you just
set the width and height of the content area. To calculate the full size of an element, you
must also add padding, borders and margins.
Example
This <div> element will have a total width of 350px:
div {
width: 320px;
padding: 10px;
border: 5px solid gray;
margin: 0;
}
Try it Yourself »
320px (width)
+ 20px (left + right padding)
+ 10px (left + right border)
+ 0px (left + right margin)
= 350px
Total element width = width + left padding + right padding + left border + right border +
left margin + right margin
Total element height = height + top padding + bottom padding + top border + bottom
border + top margin + bottom margin
position
The position CSS property sets how an element is positioned in a document. The top, right, bottom,
and left properties determine the final location of positioned elements.
Syntax
The position property is specified as a single keyword chosen from the list of values below.
static
relative
The element is positioned according to the normal flow of the document, and then offset relative to
itself based on the values of top, right, bottom, and left. The offset does not affect the position of
any other elements; thus, the space given for the element in the page layout is the same as if
position were static.
This value creates a new stacking context when the value of z-index is not auto. Its effect on table-
*-group, table-row, table-column, table-cell, and table-caption elements is undefined.
absolute
The element is removed from the normal document flow, and no space is created for the element in
the page layout. It is positioned relative to its closest positioned ancestor, if any; otherwise, it is
placed relative to the initial containing block. Its final position is determined by the values
of top, right, bottom, and left.
This value creates a new stacking context when the value of z-index is not auto. The margins of
absolutely positioned boxes do not collapse with other margins.
fixed
The element is removed from the normal document flow, and no space is created for the element in
the page layout. It is positioned relative to the initial containing block established by the viewport,
except when one of its ancestors has a transform, perspective, or filter property set to something
other than none (see the CSS Transforms Spec), in which case that ancestor behaves as the
containing block. (Note that there are browser inconsistencies
with perspective and filter contributing to containing block formation.) Its final position is
determined by the values of top, right, bottom, and left.
This value always creates a new stacking context. In printed documents, the element is placed in the
same position on every page.
sticky
The element is positioned according to the normal flow of the document, and then offset relative to
its nearest scrolling ancestor and containing block (nearest block-level ancestor), including table-
related elements, based on the values of top, right, bottom, and left. The offset does not affect the
position of any other elements.