WEB TECHNOLOGY new
WEB TECHNOLOGY new
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 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.
There are many other languages through which one can do front-end development
depending upon the framework for
example Flutter user Dart, React uses JavaScript and Django uses Python, and much more.
Backend Languages: The back end portion is built by using some languages which are
discussed below:
What is HTML?
HTML is a markup language for describing web documents (web pages).
As mentioned before, HTML is one of the most widely used languages over the web.
I'm going to list few of them here:
Web pages development - HTML is used to create pages which are rendered
over the web. Almost every page of web is having html tags in it to render its
details in browser.
Internet Navigation - HTML provides tags which are used to navigate from
one page to another and is heavily used in internet navigation.
Responsive UI - HTML pages now-a-days works well on all platforms, mobile,
tabs, desktop or laptops owing to responsive design strategy.
Offline support HTML pages once loaded can be made available offline on
the machine without any need of internet.
Game development- HTML5 has native support for rich experience and is
now useful in gaming development arena as well. Write HTML Using
Notepad or Text Editor
Adobe Dreamweaver
Microsoft Expression Web
Coffee Cup HTML Editor
However, for learning HTML we recommend a text editor like Notepad (PC) or Text
Editor (Mac).
Follow the 4 steps below to create your first web page with Notepad editor
Click Start (bottom left on your screen). Click All Programs. Click Accessories. Click
Notepad.
Open the Start Screen (the window symbol at the bottom left on your screen). Type
Notepad.
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Name the file "index.htm" or any other name ending with htm.
To open a file in a browser, double click on the file, or right-click, and choose open
with.
Example Explained
Using this description, a web browser can display a document with a heading and a
paragraph.
HTML Tags
HTML tags are keywords (tag names) surrounded by angle brackets:
<tagname>content</tagname>
Web Browsers
The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML
documents and display them.
The browser does not display the HTML tags, but uses them to determine how to
display the document:
HTML Headings
HTML headings are defined with the <h1> to <h6> tags:
Example
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
HTML paragraphs are defined with the <p> tag:
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p
HTML Links
HTML links are defined with the <a> tag:
Example
<a href="https://www.zacas.com.ng">This is a link</a>
HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), and size (width and height) are provided
as attributes:
Example
<img src="zacas.jpg" alt="zacas.com" width="104" height="142"
HTML Attributes
Example
<!DOCTYPE html>
<html lang="en-US">
<body>
</body>
</html>
The first two letters specify the language (en). If there is a dialect, use two more
letters (US).
Attribute Description
Use <br> if you want a line break (a new line) without starting a new paragraph:
Example
HTML Styling
Every HTML element has a default style (background color is white and text color is
black).
Changing the default style of an HTML element, can be done with the style attribute.
This example changes the default background color from white to lightgrey:
Example
<body style="background-color:lightgrey">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
Example
HTML Fonts
The font-family property defines the font to be used for an HTML element:
Example
The font-size property defines the text size to be used for an HTML element:
Example
<h1 style="font-size:300%">This is a heading</h1>
<p style="font-size:160%">This is a paragraph.</p>
The text-align property defines the horizontal text alignment for an HTML element:
Example
In the previous chapter, you learned about HTML styling, using the HTML style
attribute.
HTML also defines special elements, for defining text with a special meaning.
HTML uses elements like <b> and <i> for formatting output, like bold or italic text.
Bold text
Important text
Italic text
Emphasized text
Marked text
Small text
Deleted text
Inserted text
Subscripts
Superscripts
Example
Example
Example
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color:lightgray}
h1 {color:blue}
p {color:green}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
The most common way to add styling, is to keep the styles in separate CSS files. But,
in this tutorial, we use internal styling, because it is easier to demonstrate, and easier
for you to try it yourself.
CSS Syntax
The element is an HTML element name. The property is a CSS property. The value is
a CSS value.
Inline styling is useful for applying a unique style to a single HTML element:
Example
An internal style sheet can be used to define a common style for all HTML elements
on a page.
Internal styling is defined in the <head> section of an HTML page, using a <style>
element:
Example
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color:lightgrey}
h1 {color:blue}
p {color:green}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
External style sheet are ideal when the style is applied to many pages.
With external style sheets, you can change the look of an entire web site by changing
one file.
External styles are defined in an external CSS file, and then linked to in the <head>
section of an 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>
CSS Fonts
The CSS color property defines the text color to be used for the HTML element.
The CSS font-family property defines the font to be used for the HTML element.
The CSS font-size property defines the text size to be used for the HTML element.
Example
<!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>
Every HTML element has a box around it, even if you cannot see it.
The CSS border property defines a visible border around an HTML element:
Example
p{
border:1px solid black;
}
The CSS padding property defines a padding (space) inside the border:
Example
p{
border:1px solid black;
padding:10px;
}
The CSS margin property defines a margin (space) outside the border:
Example
p{
border:1px solid black;
padding:10px;
margin:30px;
}
1 Eve Jackson 94
2 John Doe 80
3 Adam Johnson 67
4 Jill Smith 50
Example
<table style="width:100%">
<tr>
<td>Zainab</td>
<td>Aminu</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Example explained:
Table rows are divided into table data with the <td> tag.
A table row can also be divided into table headings with the <th> tag.
Example
<table border="1" style="width:100%">
<tr>
<td>Aminu</td>
<td>Ahamad</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Example
table, th, td {
border: 1px solid black;
}
If you want the borders to collapse into one border, add CSS border-collapse:
Example
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
Cell padding specifies the space between the cell content and its borders.
If you do not specify a padding, the table cells will be displayed without padding.
Example
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
}
By default, all major browsers display table headings as bold and centered:
Example
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Points</th>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
To left-align the table headings, use the CSS text-align property:
Example
th {
text-align: left;
}
To set the border spacing for a table, use the CSS border-spacing property:
Example
table {
border-spacing: 5px;
}
To make a cell span more than one row, use the rowspan attribute:
Example
<table style="width:100%">
<tr>
<th>Name:</th>
<td>Aminu Ahamad</td>
</tr>
<tr>
<th rowspan="2">Telephone:</th>
<td>555 77 854</td>
</tr>
<tr>
<td>555 77 855</td>
</tr>
</table>
table#01 {
width: 100%;
background-color: #f1f1c1;
}
table#t01 tr:nth-child(even) {
background-color: #eee;
}
table#t01 tr:nth-child(odd) {
background-color: #fff;
}
table#t01 th {
color: white;
background-color: black;
}
Chapter Summary
Tag Description
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
The list items will be marked with bullets (small black circles).
Unordered List:
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Disc:
<ul style="list-style-type:disc">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Circle:
<ul style="list-style-type:circle">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Square:
<ul style="list-style-type:square">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
None:
<ul style="list-style-type:none">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
Ordered List:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
A type attribute can be added to an ordered list, to define the type of the marker:
Type Description
Numbers:
<ol type="1">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Upper Case:
<ol type="A">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Lower Case:
<ol type="a">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol
<ol type="I">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Roman Lower Case:
<ol type="i">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
The <dt> tag defines the term (name), and the <dd> tag defines the data
(description).
The HTML <form> tag is used to create an HTML form and it has following syntax −
<form action = "Script URL" method = "GET|POST">
form elements like input, textarea etc.
</form>
Example
<form>
.
form elements
.
</form>
Form elements are different types of input elements, checkboxes, radio buttons,
submit buttons, and more.
The <input> element has many variations, depending on the type attribute.
Type Description
submi
Defines a submit button (for submitting the form)
t
Form Attributes
Apart from common attributes, following is a list of the most frequently used form
attributes −
1
action
Backend script ready to process your passed data.
2
method
Method to be used to upload data. The most frequently used are GET and POST
methods.
3 target
Specify the target window or frame where the result of the script will be displayed.
It takes values like _blank, _self, _parent etc.
4
Enctype You can use the enctype attribute to specify how the browser encodes
the data before it sends it to the server. Possible values are −
application/x-www-form-urlencoded − This is the standard method most forms
use in simple scenarios.
mutlipart/form-data − This is used when you want to upload binary data in the
form of files like image, word file etc.
Text Input
<input type="text"> defines a one-line input field for text input:
Example
<form>
First name:<br>
<input type="text" name="firstname">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
First name:
Last name:
Note: The form itself is not visible. Also note that the default width of a text field is
20 characters.
Example
<form>
<input type="radio" name="sex" value="male" checked>Male
<br>
<input type="radio" name="sex" value="female">Female
</form>
Male
Female
The form-handler is typically a server page with a script for processing input data.
Example
<form action="action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="submit" value="Submit">
</form>
First name:
M ic k e y
Last name:
Mo u s e
In the example above, a server-side script is specified to handle the submitted form:
<form action="action_page.php">
If the action attribute is omitted, the action is set to the current page.
or:
If the form submission is passive (like a search engine query), and without sensitive
information.
When you use GET, the form data will be visible in the page address:
action_page.php?firstname=Mickey&lastname=Mouse
GET is best suited to short amounts of data. Size limitations are set in your
browser.
POST offers better security because the submitted data is not visible in the page
address.
This example will only submit the "Last name" input field:
Example
<form action="action_page.php">
First name:<br>
<input type="text" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="submit" value="Submit">
</form>
SCRIPT
A script is a small piece of program that can add interactivity to your website. For
example, a script could generate a pop-up alert box message, or provide a
dropdown menu. This script could be written using JavaScript or VBScript.
You can write various small functions, called event handlers using any of the
scripting language and then you can trigger those functions using HTML attributes.
Now-a-days, only JavaScript and associated frameworks are being used by most of
the web developers, VBScript is not even supported by various major browsers.
You can keep JavaScript code in a separate file and then include it wherever it's
needed, or you can define functionality inside HTML document itself. Let's see both
the cases one by one with suitable examples.
External JavaScript
If you are going to define a functionality which will be used in various HTML
documents then it's better to keep that functionality in a separate JavaScript file
and then include that file in your HTML documents. A JavaScript file will have
extension as .js and it will be included in HTML files using <script> tag.
Internal JavaScript
You can write your script code directly into your HTML document. Usually we keep
script code in header of the document using <script> tag, otherwise there is no
restriction and you can put your source code anywhere in the document but inside
<script> tag.
What is JavaScript?
JavaScript was first known as LiveScript, but Netscape changed its name to
JavaScript, possibly because of the excitement being generated by Java. JavaScript
made its first appearance in Netscape 2.0 in 1995 with the name LiveScript. The
general-purpose core of the language has been embedded in Netscape, Internet
Explorer, and other web browsers.
Advantages of JavaScript
Less server interaction − You can validate user input before sending the page
off to the server. This saves server traffic, which means fewer loads on your
server.
Immediate feedback to the visitors − They don't have to wait for a page
reload to see if they have forgotten to enter something.
Increased interactivity − You can create interfaces that react when the user
hovers over them with a mouse or activates them via the keyboard.
Richer interfaces − You can use JavaScript to include such items as drag-and
-drop components and sliders to give a Rich Interface to your site visitors.
Limitations of JavaScript
Client-side JavaScript does not allow the reading or writing of files. This has
been kept for security reason.
<script ...>
JavaScript code
</script>
Language − This attribute specifies what scripting language you are using.
Typically, its value will be JavaScript. Although recent versions of HTML (and
XHTML, its successor) have phased out the use of this attribute.
This function can be used to write text, HTML, or both. Take a look at the following
code.
<html>
<body>
<!--
document.write("Hello World!")
//-->
</script>
</body>
</html>
JavaScript Datatypes
JavaScript allows you to work with three primitive data types −
Numbers, eg. 123, 120.50 etc.
Strings of text e.g. "This text string" etc.
Boolean e.g. true or false.
JavaScript Variables
Before you use a variable in a JavaScript program, you must declare it. Variables are
declared with the var keyword as follows.
Before you use a variable in a JavaScript program, you must declare it. Variables are
declared with the var keyword as follows.
<!--
var money;
var name;
//-->
</script>
Arithmetic Operators
JavaScript supports the following arithmetic operators −
Assume variable A holds 10 and variable B holds 20, then –
1
+ (Addition)
2
- (Subtraction)
3
* (Multiplication)
Multiply both operands
4
/ (Division)
5
% (Modulus)
6
++ (Increment)
7
-- (Decrement)
The 'if...else' statement is the next form of control statement that allows JavaScript
to execute statements in a more controlled way.
Syntax
if (expression) {
Statement(s) to be executed if expression is true
} else {
Statement(s) to be executed if expression is false
}
Example
Try the following code to learn how to implement an if-else statement in JavaScript.
<html>
<body>
<!--
var age = 15;
} else {
//-->
</script>
</body>
</html>
PHP
The PHP Hypertext Preprocessor (PHP) is a programming language that allows web
developers to create dynamic content that interacts with databases. PHP is
basically used for developing web based software applications.
PHP started out as a small open source project that evolved as more and more people
found out how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back
in 1994.
As mentioned earlier, PHP is embedded in HTML. That means that in amongst your
normal HTML (or XHTML if you're cutting-edge) you'll have PHP statements like this
−
<html>
<head>
<title>Hello World</title>
</head>
<body>
</body>
</html>
VARIABLE
The main way to store information in the middle of a PHP program is by using a
variable.
Here are the most important things to know about variables in PHP.
All variables in PHP are denoted with a leading dollar sign ($).
Variables are assigned with the = operator, with the variable on the left-hand
side and the expression to be evaluated on the right.