Unit 1-2
Unit 1-2
UNIT-I
Syllabus:Introduction: Internet vs Web, Web Servers, Webpage Addresses (URL’s)
The Anatomy of webpage; Introduction to Web technologies, HTML5 and its
Essentials, New Features of HTML5.
Internet:
In simplest terms, the Internet is a global network comprised of smaller networks
that are interconnected using standardized communication protocols.
The Internet standards describe a framework known as the Internet protocol suite.
This model divides methods into a layered system of protocols.
These layers are as follows:
1. Application layer (highest) – concerned with the data(URL, type, etc.). This is
where HTTP, HTTPS, etc., comes in.
2. Transport layer – responsible for end-to-end communication over a network.
3. Network layer – provides data route.
The Internet provides a variety of information and communication facilities;
contains forums, databases, email, hypertext, etc. It consists of private, public,
academic, business, and government networks of local to global scope, linked by a
broad array of electronic, wireless, and optical networking technologies.
The World Wide Web:
The Web is the only way to access information through the Internet.
It’s a system of Internet servers that support specially formatted documents.
The documents are formatted in a mark-up language called HTML, or “Hyper Text
Mark-up Language”, which supports a number of features including links and
multimedia.
These documents are interlinked using hypertext links and are accessible via the
Internet.
To link hypertext to the Internet, we need:
1. The markup language, i.e., HTML.
2. The transfer protocol, e.g., HTTP.
3. Uniform Resource Locator (URL), the address of the resource.
We access the Web using Web browsers.
Difference between Web and Internet:
Internet Web
It is also known as the Network of The Web is a model for sharing
Networks. information using the Internet.
The Internet is a way of transporting The protocol used by the web is HTTP.
information between devices.
Accessible in a variety of ways. The Web is accessed by the Web
Browser.
Network protocols are used to transport Accesses documents and online sites
data. through browsers.
The Internet is the network of networks The Web is a way to access information
and the network allows to exchange of through the Internet.
data between two or more computers.
URI:
URI stands for ‘Uniform Resource Identifier’. A URI can be a name, locator, or both
for an online resource whereas a URL is just the locator.
URLs are a subset of URIs. A URL is a human-readable text that was designed to
replace the numbers (IP addresses) that computers use to communicate with
servers.
A URL consists of a protocol, domain name, and path (which includes the specific
subfolder structure where a page is located) like-
1. Protocol – HTTP or HTTPS.
2. WebSiteName – geeksforgeeks, google etc.
3. topLevelDomain- .com, .edu, .in etc.
4. path- specific folders and/or subfolders that are on a given website.
Web Server
The term web server can refer to hardware or software, or both of them working
together.
1. On the hardware side, a web server is a computer that stores web server
software and a website's component files (for example, HTML documents,
images, CSS stylesheets, and JavaScript files). A web server connects to the
Internet and supports physical data interchange with other devices connected
to the web.
2. On the software side, a web server includes several parts that control how
web user’s access hosted files. This is an HTTP server. An HTTP server is
software that understands URLs (web addresses) and HTTP (the protocol your
browser uses to view webpages). An HTTP server can be accessed through the
domain names of the websites it stores, and it delivers the content of these
hosted websites to the end user's device.
At the most basic level, whenever a browser needs a file that is hosted on a web
server, the browser requests the file via HTTP. When the request reaches the correct
(hardware) web server, the (software) HTTP server accepts the request, finds the
requested document, and sends it back to the browser, also through HTTP.
Fig. Web Server
To publish a website, you need either a static or a dynamic web server.
A static web server, or stack, consists of a computer (hardware) with an HTTP server
(software). We call it "static" because the server sends its hosted files as-is to your
browser.
A dynamic web server consists of a static web server plus extra software, most
commonly an application server and a database. We call it "dynamic" because the
application server updates the hosted files before sending content to your browser
via the HTTP server.
For example, to produce the final webpages you see in the browser, the application
server might fill an HTML template with content from a database. Sites like MDN or
Wikipedia have thousands of webpages. Typically, these kinds of sites are composed
of only a few HTML templates and a giant database, rather than thousands of static
HTML documents. This setup makes it easier to maintain and deliver the content.
The page tile is set using the <title></title> set of tags in the head section of the html
coding. This is the only web page element within the head section of the web page
the visitor will see.
URL (Domain Name)
The URL is the domain name of the website. If the visitor just typed
www.domainname.com they would be taken to the home page of the website.
File Name
File name is the web page file name. It cannot contain any spaces! The file name can
be written as one long name (e.g. basichtmlarticles.htm), with hyphens (e.g. basic-
html-articles.htm, as shown in the image above) or with underscores (e.g.
basic_html_articles.htm).
When you create a web page you have to give it a name. The file name has what is
called an extension at the end of it.
The extension at the end of the file name tells the browser what kind of file it is. A
HTML document would have an extension of .htm or html. If your web page uses a
certain programming language it would have the appropriate extension. e.g. .php is
for the PHP programming language, .asp is for the ASP programming language.
Scroll Bars
Scroll bars are on the right side and bottom of the browser window. If there is a scroll
bar at the bottom (horizontal scroll bar) your web page content is too wide for the
browser window.
A web page layout should be designed so there is no horizontal scroll bar. You need
to test your web page at different resolutions and on different operating systems to
see if the way the page is laid out will result in horizontal scroll bars when viewed at
smaller resolutions or by different operating systems.
One way to avoid this problem is to use a flexible (fluid) design. A flexible design will
adjust to the browser window size. As long as all your elements add up to less than
the browser width there will not be a horizontal scroll bar.
Header
The header is at the very top of the web page. It usually contains a logo for the
website.
Navigation
A website can use a left navigation system, a right navigation system or a navigation
system that spans horizontally right under the header or above the header.
The navigation system of a website has to be consistent throughout the website so
the visitor will learn your navigation system. Changing the navigation system from
page to page is confusing to the visitor and they will get frustrated and leave!
Web Page Content
Web page content includes everything between the <body> and </body> tags. We
have already looked at some of the web page content, the header and navigation
system.
Footer
The footer is the bottom section of the web page.
Web Technologies:
Web Technology refers to the various tools and techniques that are utilized in the
process of communication between different types of devices over the internet. A web
browser is used to access web pages. Web browsers can be defined as programs that
display text, data, pictures, animation, and video on the Internet. Hyperlinked
resources on the World Wide Web can be accessed using software interfaces provided
by Web browsers.
Web Technology can be classified into the following sections:
World Wide Web (WWW): The World Wide Web is based on several different
technologies : Web browsers, Hypertext Markup Language (HTML) and Hypertext
Transfer Protocol (HTTP).
Web Browser: The web browser is an application software to explore www (World
Wide Web). It provides an interface between the server and the client and requests to
the server for web documents and services.
Web Server: Web server is a program which processes the network requests of the
users and serves them with files that create web pages. This exchange takes place
using Hypertext Transfer Protocol (HTTP).
Web Pages: A webpage is a digital document that is linked to the World Wide Web
and viewable by anyone connected to the internet has a web browser.
Web Development: Web development refers to the building, creating, and
maintaining of websites. It includes aspects such as web design, web publishing, web
programming, and database management. It is the creation of
an application that works over the internet i.e. websites.
Web Development can be classified into two ways:
Frontend Development: The part of a website that the user interacts directly is
termed as front end. It is also referred to as the ‘client side’ of the application.
Backend Development: Backend is the server side of a website. It is the part of the
website that users cannot see and interact. It is the portion of software that does not
come in direct contact with the users. It is used to store and arrange data.
Frontend Languages: The front end portion is built by using some languages which are
discussed below:
HTML: HTML stands for Hypertext Markup Language. It is used to design the
front-end portion of web pages using a markup language. HTML is the
combination of Hypertext and Markup language. Hypertext defines the link
between the web pages. The markup language is used to define the text
documentation within the tag which defines the structure of web pages.
CSS: Cascading Style Sheets fondly referred to as CSS is a simply designed
language intended to simplify the process of making web pages presentable.
CSS allows you to apply styles to web pages. More importantly, CSS enables you
to do this independent of the HTML that makes up each web page.
JavaScript: JavaScript is a famous scripting language used to create magic on
the sites to make the site interactive for the user. It is used to enhancing the
functionality of a website to running cool games and web-based software.
AJAX: Ajax is an acronym for Asynchronous Javascript and XML. It is used to
communicate with the server without refreshing the web page and thus
increasing the user experience and better performance.
Backend Languages: The back end portion is built by using some languages which are
discussed below:
page.
HTML page structure: The basic structure of an HTML page is laid out below. It
contains the essential building-block elements (i.e. doctype declaration, HTML,
head, title, and body elements) upon which all web pages are created.
<DOCTYPE! html>: This is the document type declaration (not technically a tag). It
declares a document as being an HTML document. The doctype declaration is not
case-sensitive.
<html>: This is called the HTML root element. All other elements are contained
within it.
<head>: The head tag contains the “behind the scenes” elements for a webpage.
Elements within the head aren’t visible on the front-end of a webpage. HTML
elements used inside the <head> element include:
<style>
<title>
<base>
<noscript>
<script>
<meta>
<link>
<body>: The body tag is used to enclose all the visible content of a webpage. In
other words, the body content is what the browser will show on the front-end.
An HTML document can be created using any text editor. Save the text file
using .html or .htm. Once saved as an HTML document, the file can be opened as a
webpage in the browser.
<!DOCTYPE html>
<html>
<head>
<title>Demo Web Page</title>
</head>
<body>
<h1>fundamentals of web development</h1>
</body>
</html>
Features of HTML:
It has introduced new multimedia features which supports audio and video
controls by using <audio> and <video> tags.
There are new graphics elements including vector graphics and tags.
Enrich semantic content by including <header><footer>, <article>, <section>
and <figure> are added.
Drag and Drop- The user can grab an object and drag it further dropping it on a
new location.
Geo-location services- It helps to locate the geographical location of a client.
Web storage facility which provides web application methods to store data on
web browser.
Uses SQL database to store data offline.
Allows to draw various shapes like triangle, rectangle, circle, etc.
Capable of handling incorrect syntax.
Easy DOCTYPE declaration i.e. <!doctype html>
Easy character encoding i.e. <meta charset=”UTF-8″>
Advantages:
All browsers supported.
More device friendly.
Easy to use and implement.
HTML 5 in integration with CSS, JavaScript, etc can help build beautiful websites.
Disadvantages:
Long codes have to be written which is time consuming.
Only modern browsers support it.
UNIT-II
Fundamentals of HTML, Working with Text, organizing text in HTML, Working with
Links and URLs, Creating Tables, Working with Images, Working with Forms,
Interactive Elements.
The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration represents the document type, and helps browsers to
display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
The <!DOCTYPE> declaration is not case sensitive.
The <!DOCTYPE> declaration for HTML5 is:
<!DOCTYPE html>
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines the least important heading:
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Links
HTML links are defined with the <a> tag:
<a href="https://www.w3schools.com">This is a link</a>
The link's destination is specified in the href attribute.
Attributes are used to provide additional information about HTML elements.
HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are provided as
attributes:
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">
HTML Elements
The HTML element is everything from the start tag to the end tag:
<tagname>Content goes here...</tagname>
Examples of some HTML elements:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
Start tag Element content
<br> none
HTML Attributes
All HTML elements can have attributes
Attributes provide additional information about elements
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name="value"
<h2>Relative URLs</h2>
<p><a href="html_images.asp">HTML Images</a></p>
<p><a href="/css/default.asp">CSS Tutorial</a></p>
The width and height Attributes
The <img> tag should also contain the width and height attributes, which specifies
the width and height of the image (in pixels):
Example
<img src="img_girl.jpg" width="500" height="600">
The alt Attribute
The required alt attribute for the <img> tag specifies an alternate text for an image, if
the image for some reason cannot be displayed. This can be due to slow connection,
or an error in the src attribute, or if the user uses a screen reader.
Example
<img src="img_girl.jpg" alt="Girl with a jacket">
The style Attribute
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>
The lang Attribute
You should always include the lang attribute inside the <html> tag, to declare the
language of the Web page. This is meant to assist search engines and browsers.
The following example specifies English as the language:
<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
</html>
Country codes can also be added to the language code in the lang attribute. So, the
first two characters define the language of the HTML page, and the last two
characters define the country.
The following example specifies English as the language and United States as the
country:
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
The title Attribute
The title attribute defines some extra information about an element.
The value of the title attribute will be displayed as a tooltip when you mouse over
the element:
Example
<p title="I'm a tooltip">This is a paragraph.</p>
Example
A simple HTML table:
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>AlfredsFutterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
Table Cells
Each table cell is defined by a <td> and a </td> tag.
Everything between <td> and </td> are the content of the table cell.
Example
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
</table>
able Rows
Each table row starts with a <tr> and end with a </tr> tag.
Example
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
able Headers
Sometimes you want your cells to be headers, in those cases use the <th> tag
instead of the <td> tag:
Example
Let the first row be table headers:
<table>
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
Html forms:
An HTML form is used to collect user input. The user input is most often sent to
a server for processing.
The <form> Element
The HTML <form> element is used to create an HTML form for user input:
<form>
.
form elements
.
</form>
The <form> element is a container for different types of input elements, such
as: text fields, checkboxes, radio buttons, submit buttons, etc.
Type Description
<input type="radio"> Displays a radio button (for selecting one of many choices)
Text Fields
The <input type="text"> defines a single-line input field for text input.
Example
A form with input fields for text:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>
The <label> element is useful for screen-reader users, because the screen-
reader will read out loud the label when the user focus on the input element.
The <label> element also help users who have difficulty clicking on very small
regions (such as radio buttons or checkboxes) - because when the user clicks
the text within the <label> element, it toggles the radio button/checkbox.
The for attribute of the <label> tag should be equal to the id attribute of
the <input> element to bind them together.
Radio Buttons
The <input type="radio"> defines a radio button.
<form>
<input type="radio" id="html" name="fav_language" value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language" value="CSS">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language" value="JavaSc
ript">
<label for="javascript">JavaScript</label>
</form>
Checkboxes
The <input type="checkbox"> defines a checkbox.
Example
A form with checkboxes:
<form>
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="vehicle3"> I have a boat</label>
</form>
The form-handler is typically a file on the server with a script for processing
input data.
<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>
If the name attribute is omitted, the value of the input field will not be sent at
all.
Example
This example will not submit the value of the "First name" input field:
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" value="John"><br><br>
<input type="submit" value="Submit">
</form>