IWP Unit 1 Notes
IWP Unit 1 Notes
Reddy ,SIT,Tumkur
Introduction to
Web Programming
(PLC1)
Unit-I
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
Back-end development controls what goes on behind the scenes of a web application. A
back-end often uses a database to generate the front-end.
Examples of web applications are social networking sites like Facebook or e-commerce sites
like Amazon.
Personal computer/Laptop − This is the PC/Laptop at which we sit to see the web.
A Web browser − A software installed on PC which helps to browse the Web.
Routers & Switches − They are the combination of software and hardware who take
request and pass to appropriate Web server.
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
The Web is known as a client-server system. The computer is the client and the remote
computers that store electronic files are the servers.
Q) Elaborate about Web usage functionality (OR) How the Web works?
Ans)
Web usage functionality (Or) How the Web Works?
When we 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 we type in Google.com it gets translated into
a number, which identifies the computers that serve the Google Website .
When we want to view any page on the Web, we must initiate the activity by requesting a
page using browser. The browser asks a domain name server to translate the domain name
we requested into an IP address. The browser then sends a request to that server for the page
we 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.
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
Q) Distinguish between static web sites and dynamic web sites and list
examples to each.
Ans)
Ans) The <HTML> is a markup language that is used by the browser to manipulate text,
images, and other content to display it in the required format.
Tags in HTML: Tags are one of the most important part in an HTML Document. HTML
uses some predefined tags which tells the browser about content display property, that is how
to display a particular given content. For Example, to create a paragraph, one must use the
paragraph tags(<p> </p>) and to insert an image one must use the img tags(<img />).
There are generally two types of tags in HTML:
1. Paired Tags: These tags come in pairs. That is they have both opening(<
>) and closing(</ >) tags.
2. Empty Tags: These tags do not require to be closed.
HEAD: This contains the information about the HTML document. For Example, Title
of the page, version of HTML, Meta Data etc.
BODY: This contains everything you want to display on the Web Page.
Q) Elaborate all text format tags used in HTML and implement those tags
using HTML code.
Ans) Text formatting tags used in HTML
Demonstration:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Formatting Tags Example</title>
</head>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
<body>
</body>
</html>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
Ans)
<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Priya</td>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
<td>Sharma</td>
<td>24</td>
</tr>
<tr>
<td>Arun</td>
<td>Singh</td>
<td>32</td>
</tr>
<tr>
<td>Sam</td>
<td>Watson</td>
<td>41</td>
</tr>
</table>
</body>
</html>
Q) Demonstrate HTML table with adding style , alignment and cell padding using HTML
code.
Ans)
<html>
<head>
<style>
table,
th,
td {
border: 1px solid black;
border-collapse: collapse;
}
th,
td {
padding: 20px;
}
th {
text-align: left;
}
</style>
</head>
<body>
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
<tr>
<td>Priya</td>
<td>Sharma</td>
<td>24</td>
</tr>
<tr>
<td>Arun</td>
<td>Singh</td>
<td>32</td>
</tr>
<tr>
<td>Sam</td>
<td>Watson</td>
<td>41</td>
</tr>
</table>
</body>
</html>
Q) Define XHTML and describe its significance. Elaborate Why does developers migrate
their content to XHTML 1.0.
Ans)
XHTML stands for EXtensibleHyperTextMarkupLanguage. It is the next step in the
evolution of the internet. The XHTML 1.0 is the first document type in the XHTML family.
XHTML is almost identical to HTML 4.01 with only few differences. This is a cleaner and
stricter version of HTML 4.01. If you already know HTML, then you need to give little
attention to learn this latest version of HTML.
XHTML was developed by World Wide Web Consortium (W3C) to help web developers
make the transition from HTML to XML. By migrating to XHTML today, web developers
can enter the XML world with all of its benefits, while still remaining confident in the
backward and future compatibility of the content.
Why Use XHTML?
Developers who migrate their content to XHTML 1.0 get the following benefits:
• XHTML documents are XML conforming as they are readily viewed, edited, and validated
with standard XML tools.
• XHTML documents can be written to operate better than they did before in existing
browsers as well as in new browsers.
• XHTML gives you a more consistent, well-structured format so that your webpages can be
easily parsed and processed by present and future web browsers.
• We can easily maintain, edit, convert and format your document in the long run.
• Since XHTML is an official standard of the W3C, your website becomes more compatible
with many browsers and it is rendered more accurately.
• XHTML combines strength of HTML and XML. Also, XHTML pages can be rendered by
all XML enabled browsers.
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
• XHTML defines quality standard for your webpages and if you follow that, then your web
pages are counted as quality web pages. The W3C certifies those pages with their quality
stamp.
Q) Describe about Document Type Definition DTD in xhtml. why is it needed?
Ans)
DTD, which stands for Document Type Definition, is a set of rules that defines the structure
and legal elements and attributes of an XML or XHTML document. It essentially serves as a
contract or blueprint that dictates how elements and attributes should be used in a document.
In the context of XHTML, DTD ensures that XHTML documents adhere to specific rules and
guidelines, making them well-formed and valid.
Validation: DTD provides a way to validate XHTML documents. It allows software (such as
web browsers or XML parsers) to check if the structure of an XHTML document conforms to
the rules specified in the DTD. This validation helps ensure that the document is well-formed
and follows the expected syntax.
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<h1>This is a Heading</h1>
<p>This is a paragraph in an XHTML document.</p>
</body>
</html>
Q) List the important points to remember while writing a new XHTML document or
converting existing HTML document into XHTML document:
Ans.
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Q) Use HTML code to construct a form and add the components for different types of
inputs such as text field, buttons , check boxes , radio buttons , textarea and selection
elements.
<!DOCTYPE html>
<html>
<head>
<title>FORM DEMO</title>
</head>
<body bgcolor=yellow>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
<form>
<h1>
<br><br>
User ID : <input type = "text" name ="user_id" />
<br>
Password: <input type = "password" name = "password" />
<hr><br>
Description : <br />
<textarea rows = "5" cols = "50" name = "description">
Enter description here...
</textarea>
<hr><br>
<input type = "checkbox" name = "Java" value = "on" checked> Java
<input type = "checkbox" name = "Python" value = "on"> Python
<hr><br>
</html>
Ans)
The embedded CSS code that wraps around every HTML element. It consists of: margins,
borders, padding, and the actual content. The image below illustrates the box model
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
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
div {
width: 300px;
border: 15px solid green;
padding: 50px;
margin: 20px;
}
Some of the important programs being used in HTML and XHTML are
Q. Create a HTML document giving details of your [Name, Age], [Address, Phone] and [Register
Number, Class] aligned in proper order using alignment attributes of Paragraph tag.
Procedure:
<html>
<head>
<title>program 02</title>
</head>
<body>
<p align="center">
Name: AITS<br>
Age: 16
</p>
<p align="right">
123535615
</p>
<p align="left">
Reg No:
20AK1A0501<br>
Class:1stSem
</p>
</body>
</html>
Q)Create a page to show different character formatting (B, I, U, SUB, SUP) tags.
viz :log b mp
= p logbm
Procedure:
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
3. Include <b>,<u>,<sup>,<sub>,tags
<html>
<head>
<title>program 04</title>
</head>
<body>
</b><sub>b</sub> m</p>
</body>
</html>
Q) Write HTML code to create a Web Page that contains an Image at its centre.
Procedure:
3. Include <img> tag inside <center> tag and set align attribute of img tag to middle
<html>
<head>
<title>program 05</title>
</head>
<body>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
<center>
</center>
</body>
</html>
<html>
<head>TABLE TAG</head>
<title>TABLE</title>
<body>
<style>
table, th, td
border-collapse:collapse;
padding:15px;
#t01
background-color: #f1f1c1;
td{text-align:center;}
</style>
<table id="t01">
<tr>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
<thcolspan="4">AI&DS</th>
</tr>
<tr>
<thcolspan="4">Monday</th>
</tr>
<tr>
<th>9:30-10:20</th>
<th>10:30-11:20</th>
<th>11:30-12:20</th>
<th>12:30-1:20</th>
</tr>
<tr>
<td>P&S</td>
<td>DS</td>
<td>PY</td>
<td>NM</td>
</tr>
</table>
<hr>
<table id="t02">
<tr>
<throwspan="4">CSE-2</th>
</tr>
<tr>
<thcolspan="4">Monday</th>
</tr>
<tr>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
<th>9:30-10:20</th>
<th>10:30-11:20</th>
<th>11:30-12:20</th>
<th>12:30-1:20</th>
</tr>
<tr>
<td>PHY</td>
<td>P&S</td>
<td>ENG</td>
</tr>
</table>
</body>
</html>
Introduction to Web Programming (PLC1) By Y.V.Reddy ,SIT,Tumkur
….End of Unit-I…..