BWD Unit-1
BWD Unit-1
HTTP
The machine where the Web site actually resides is called a Web
server.
The web pages and related resources are stored into the central computer
and these files to be read over TCP/IP is called web server.
The server computer runs special software called web server that do:
Website Management
Receive Clients Requests and Respond to a client’s request by
providing the page.
When we send a request for a Web page by entering a Web site address,
this request is sent to a Web Server. The Web server then sends the Web
page to your browser.
In the case of the Internet, the web server and browser are usually on two
different machines, possibly many miles apart. However, in a more local
situation, we might set up a machine that runs the web server software,
and then use a browser on the same machine to look at its web pages.
Computers that offer the facility to read information stored in the web
pages are called Web Clients.
Advantages Disadvantages
Complexity- A lot of code can be
Easy- It is super easy to learn and use.
complex to handle
Independent- It is a platform- Security- It is not secure on its own.
independent language which means it You need third-party services to
can work across all devices. provide more security.
Industry Standard- Accepted by all Limitations- Alone HTML does not
modern browsers like Chrome, Safari, have many capabilities. Html alone
Opera, etc can create basic web pages.
Not Centralized- Each page should be
Simplicity – The coding structure is
programmed separately. It is one of
very simple to understand
the biggest disadvantages.
HTML is simple to edit as is Dynamic Pages- Creating dynamic
plain text. pages is hard. By default all HTML
pages are static.
Write Code- You have to write code for
Embed Media- Easily embed audio,
the simplest web pages. It can be a
video, photos, and other types of
problem if a website has a lot of
media files.
pages.
Structure of HTML
<!DOCTYPE html>
<html>
<head>
<title>
</title>
</head>
<body>
</body>
</html>
What is Tag?
1 Paired Tags
A tag is said to be a paired tag if they have both Opening Tag and the Closing
Tag. Paired tags are also known as Container Tags.
Example#
<b>Hi i am Shyam </b>
2. Unpaired Tags
An unpaired tag does not have a companion tag. Unpaired tags are also known
as Singular or Stand-Alone Tags.
Example#
<br> , <hr>
What is Element?
An element in HTML usually consist of a start tag <tag name>, close tag </tag
name> and content inserted between them.
Such as:
<title>WebPage</title>
Comment Tag:-
You can add comments to your HTML source by using the following syntax:
<p>This is a paragraph.</p>
<!DOCTYPE> Declaration
<HTML> Tag
USE: HTML tag represents the root of html document, holding all the
content of an HTML document, and it also tells the browser that
you're using HTML.
<head> tag
1) Title Example:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to HTML</title>
</head>
<body>
</body>
</html>
<title> tag
USE: The <title> tag defines the title of the document. The title must be
text only and it is shown in browser’s title bar.
The <title> tag is required in HTML document.
The content of a page title is very important for search engine
optimization.
You can have more than one <title> element in HTML document.
2)<Style >
The <style> tag in HTML helps us to modify our text, viewed in the page. This
modification includes changing font size, font family, font color etc. Not only the
texts but also we can change the style of a body ar part of a page. Now let’s
look at various attributes of style and what else the tag supports.
The <style> tag is used to define style information (CSS) for a document.
Syntax:
<tagname style="property:value;">
The tagname includes <p>, <body>, from <h1> to <h6> etc.
The property is borrowed from CSS like color, font-size, font-family
etc.
The value is also borrowed from CSS.
1)HTML Font Family: The font family changes the font style of a text and can
be used in any text writing tag like <p> or heading tag.
<html>
<head>
<title>Font Family</title>
</head>
<body>
<h1 style="font-family:commanders;">Welcome to HTML.</h1>
<h2 style="font-family:Chaparral Pro Light;"> Welcome to HTML.</h2>
<h3 style="font-family:algerian;"> Welcome to HTML.</h3>
<p style="font-family:Castellar;"> Welcome to HTML.</p>
</body>
</html>
2)HTML Font Size: The font size changes the size of a text and this can also
be used in any text writing tag like <p> or heading tag. The units can be given
in “%” or pixels or other units can also be included.
Example:
<html>
<head>
<title>Font Size</title>
</head>
<body>
<h1 style="font-size:80%;"> Welcome to HTML..</h1>
<h2 style="font-size:150%;"> Welcome to HTML..</h2>
<h3 style="font-size:20px;"> Welcome to HTML..</h3>
<p style="font-size:30px;"> Welcome to HTML..</p>
</body>
</html>
3)HTML Font Color: The font color tag changes the color of a text and can be
used in any text writing tag like <p> or heading tag. We can use both name of
the colors or also the color codes that is mainly used in Photoshop. For various
color codes or to pick from various color ranges refer HTML Color Codes.
Example:
<html>
<head>
<title>Font Color</title>
</head>
<body>
</body>
</html>
4)HTML Text Align: The text alignment tag is used to change the alignment
of a text including centre, left or right alignment.
Example:
<html>
<head>
<title>Text Align</title>
</head>
<body>
<h1 style="text-align:left;"> Welcome to HTML.</h1>
<h2 style="text-align:center;"> Welcome to HTML.</h2>
<p style="text-align:right;"> Welcome to HTML.</p>
</body>
</html>
5)HTML Background Color: Using this attribute we can change the color of
the background page or web page. This attribute is used along with the body
tag to change the whole color of the body. It can also be used along with the
text tags to change the text block’s color.
Example:
<html>
<head>
<title>Background Color</title>
</head>
<body style="background-color:#616A6B;">
<h1 style="font-family:commanders;
background-color:yellow;">Hello GeeksforGeeks.</h1>
<h2 style="font-family:algerian;
background-color:cyan;">Hello GeeksforGeeks.</h2>
<p style="font-family:Castellar;
background-color:green;">Hello GeeksforGeeks.</p>
</body>
</html>
3)Base:-
The <base> tag specifies the base URL and/or target for all relative URLs in a
document.
The <base> tag must have either an href or a target attribute present, or both.
There can only be one single <base> element in a document, and it must be
inside the <head> element
Syntax:
<base href = "SAMPLE_URL">
Example:-
Specify a default URL and a default target for all links on a page:
<head>
<base href="https://example.com//" target="_blank">
</head>
<body>
<a href="https://example.com/">HTML base Tag</a>
</body>
4)Link
A hyperlink (or link) is a word, group of words, or image that you can click on to
jump to another document.
When you move the cursor over a link in a Web page, the arrow will turn into a
little hand.
The most important attribute of the <a> element is the href attribute, which
indicates the link’s destination.
Absolute path contains parent folders and directory information. It needs to define whole
path for hyper link in the HREF attribute
RELATIVE
With Image
<a href="url"><img src=’path’></a>
Example:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
By default, the linked page will be displayed in the current browser window. To
change this, you must specify another target for the link.
Example:
<!DOCTYPE html>
<html>
<body>
<p>If target="_blank", the link will open in a new browser window or tab.</p>
</body>
</html>
5)Meta:-
HTML <meta> tag is used to represent the metadata about the HTML document.
It specifies page description, keywords, copyright, language, author of the
documents, etc.
The metadata does not display on the webpage, but it is used by search engines,
browsers and other web services which scan the site or webpage to know about
the webpage.
With the help of meta tag, you can experiment and preview that how your
webpage will render on the browser.
The <meta> tag is placed within the <head> tag, and it can be used more than
one times in a document.
Example:-
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<p>All meta information goes in the head section...</p>
</body>
</html>
Common uses for JavaScript are image manipulation, form validation, and
dynamic changes of content.
Example:-
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1> JavaScript Tutorials</h1>
<script>
//write JavaScript code here..
alert('Hello, how are you?')
</script>
</body>
</html>
<body> tag
USE: The <body> tag defines the document’s body. The <body> element
contains all the contents of HTML document such as headings,
paragraphs, images, hyperlinks, tables, lists etc.
There can be only one <body> element in HTML document.
Syntax:
<body> Body Contents... </body>
What is Attributes:
Syntax:
<element attribute_name="value">content</element>
Example:
1. <!DOCTYPE html>
2. <html>
3. <head>
4. </head>
5. <body>
6. <h1> This is Style attribute</h1>
7. <p style="height: 50px; color: blue">hello welcome to html </p>
8. <p style="color: red">It will change the color of content</p>
9. </body>
10.</html>
Attributes: There are many attributes in the <body> tag which are
depreciated from HTML5 are listed below:
background: It contains the URL of the background image. It is used
to set the background image.
bgcolor: It is used to specify the background color of an image.
alink: It is used to specify the color of the active link.
link: It is used to specify the color of visited links.
text: It specifies the color of the text in a document.
vlink: It specifies the color of visited links.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h2>Background Image</h2>
<p>A background image for a p element:</p>
<p style="background-image: url('download.jfif');">
You can specify background images<br>
for any visible HTML element.<br>
In this example, the background image<br>
is specified for a p element.<br>
By default, the background-image<br>
will repeat itself in the directions.<br>
browser window to see how the<br>
background image behaves.</p>
</body>
</html>
Introduction to HTML 5
HTML 5 is the fifth and current version of HTML. HTML5 is not only a new version
of HTML language enriched with new elements and attributes, but a set of
technologies for building more powerful and diverse web sites and applications,
that support multimedia, interact with software interfaces, etc.
Advnatage of HTML5:-
It Supports by all Modern Browsers
It is more device friendly.it is easy for use.
It has introduced new multimedia features which support 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.
It supports geolocation, which makes it possible to determine the
users’ location.
Web storage facility which provides web application methods to store
data on the web browser.
Uses SQL database to store data offline.
Capable of handling incorrect syntax.
DisAdvantage of HTML5:
It supported only by modern browsers.
You must write long code which is time-consuming.
Structure of HTML 5
<body>
<header>...</header>
<nav>...</nav>
<article>
<section>
...
</section>
</article>
<aside>...</aside>
<footer>...</footer>
</body>
<section>
We can think section is like group in which particular information will display.
Example #
<section id="about_us_info">
<h1> heading </h1>
<p> some data </p>
</section>
<section id="contact_info">
<h1> heading </h1>
<p> some data </p>
</section>
<article>
Example#
<article class="article">
<p>article, some text</p>
<article class="comment"><p>comment 1</p></article>
<article class="comment"><p>comment 2</p></article>
<article class="comment"><p>comment 3</p></article>
<article>
<aside>
We can show content related to that article but not part of the main flow.
Example#
<section id="main_content_info">
<h1> heading </h1>
<p> some data </p>
</section>
<aside id="top_5songs_list">
some data
</aside>
<header> <footer>
<header> as the name suggest ,The <header> tag can be used to group header
information, of a whole document or an article, inside a document. <footer> tag
typically contains the author of the document, copyright information, links to
terms of use, contact information, etc.
We can have multiple header and footer tags in one page, of different section.
Each article could have it's own header.
Example#
<section id="page">
<header>the page header content</header>
<article>
<header>the article header</header>
<footer>the article footer</footer>
</article>
</section>
<footer>the page footer content</footer>
<nav>
As the name suggess ,the nav section tag is used to delimiter a navigation area of
your document.
We can add hyperlink and menus from here.
Example#
<body>
<header>
<nav>
<ul>
<li>navigation button 1</li>
<li>navigation button 2</li>
<li>navigation button 3</li>
</ul>
</nav>
</header>
</body>
Example 2:
<html>
<head>
<title>Nav Tag</title>
<style>
a{
text-decoration: none;
color: green;
font-size: 20px;
padding: 8px;
}
a:hover{
color: blue;
}
h1{
text-align: center;
}
</style>
</head>
<body>
<h1>Example of Nav tag</h1>
<nav>
<a href="#">Home</a> |
<a href="#">Courses</a> |
<a href="#">About-us</a> |
<a href="#">Contact-us</a> |
</nav>
</body>
</html>