Day 1 HTML Basics
Day 1 HTML Basics
TRAINER’S NAME:-
Prof. Vandana
Rai
Prof. Deepti
Gopal
Session- 1
Users can access the content of these sites from any part of the world over the
internet using their devices such as computers, laptops, cell phones, etc. The
WWW, along with the internet, enables the retrieval and display of text and
media to your device.
A web page is given an online address called a Uniform Resource Locator
(URL). A particular collection of web pages that belong to a specific URL is
called a website, e.g., www.facebook.com, www.google.com, etc. So, the World
Wide Web is like a huge electronic book whose pages are stored on multiple
servers across the world.
Small websites store all of their Webpages on a single server, but big websites
or organizations place their Webpages on different servers in different countries
so that when users of a country search their site they can get the information
quickly from the nearest server.
HTTP:The HyperText Transfer Protocol is the client-server network protocol
that has been in use by the World-Wide Web since 1990. Whenever you surf the
web, your browser will be sending HTTP request messages for HTML pages,
images, scripts and stylesheets. Web servers handle these requests by returning
response messages that contain the requested resource.
Many applications are running concurrently over the Web, such as web
browsing/surfing, e-mail, file transfer, audio & video streaming, and so on. In
order for proper communication to take place between the client and the server,
these applications must agree on a specific application-level protocol such as
HTTP, FTP, SMTP, POP, and etc.
2. Introduction to Web Browser and Web Server.
Web Browser
A web browser (also referred to as an Internet browser or simply a browser) is
application software for accessing the World Wide Web or a local website. When
a user requests a web page from a particular website, the web browser retrieves
the necessary content from a web server and then displays the page on the user's
device.
A web browser is not the same thing as a search engine, though the two are often
confused. A search engine is a website that provides links to other websites.
However, to connect to a website's server and display its web pages, a user must
have a web browser installed.
Function of Web Browser
The purpose of a web browser is to fetch content from the Web or from a local
storage device and display it on a user's device.
This process begins when the user inputs a Uniform Resource Locator (URL),
such as https://en.wikipedia.org/, into the browser. Virtually all URLs on the
Web start with either http: or https: which means the browser will retrieve them
with the Hypertext Transfer Protocol (HTTP). In the case of secure mode
(HTTPS), the communication between the browser and the web server is
encrypted for the purposes of security and privacy.
Once a web page has been retrieved, the browser's rendering engine displays it
on the user's device. This includes image and video formats supported by the
browser.
Web pages usually contain hyperlinks to other pages and resources. Each link
contains a URL, and when it is clicked or tapped, the browser navigates to the
new resource. Thus the process of bringing content to the user begins again.
Most browsers use an internal cache of web page resources to improve
loading times for subsequent visits to the same page. The cache can store
many items, such as large images, so they do not need to be downloaded from
the server again. Cached items are usually only stored for as long as the web
server stipulates in its HTTP response messages.
Web Server.
Web server is a computer where the web content is stored.
Basically web server is used to host the web sites but there
exists other web servers also such as gaming, storage, FTP,
email etc. Web site is collection of web pages while web
server is a software that responds to the request for web
resources.
Web Server Working: Web server respond to the client
request in either of the following two ways:
● Sending the file to the client associated with the
requested URL.
● Generating response by invoking a script and
communicating with database
3. Introduction to HTML
HTML is the standard markup language for creating Web pages.
What is HTML?
HTML stands for Hyper Text Markup Language
HTML is the standard markup language for creating Web pages
HTML describes the structure of a Web page
HTML consists of a series of elements
HTML elements tell the browser how to display the content
HTML elements label pieces of content such as "this is a heading", "this is a
paragraph", "this is a link", etc.
HTML stands for Hypertext Markup Language. It is used to design web pages
using a markup language. HTML is the combination of Hypertext and Markup
language. Hypertext defines the link between the web pages. A markup
language is used to define the text document within a tag which defines the
structure of web pages.
This language is used to annotate (make notes for the computer) text so that a
machine can understand it and manipulate text accordingly. Most markup
languages (e.g. HTML) are human-readable. The language uses tags to define
what manipulation has to be done on the text.
HTML is a markup language used by the browser to manipulate text, images,
and other content, in order to display it in the required format. HTML was
created by Tim Berners-Lee in 1991. The first-ever version of HTML was
HTML 1.0, but the first standard version was HTML 2.0, published in 1995.
Why learn HTML?
● It is a simple markup language. Its implementation is easy.
● It is used to create a website.
● Helps in developing fundamentals about web
programming.
● Boost professional career.
Supported Browsers:
● Google Chrome 93.0
● Firefox 92.0
● Internet Explorer 11.0
Elements and Tags:
HTML uses predefined tags and elements which tell the browser how to properly
display the content. Remember to include closing tags. If omitted, the browser
applies the effect of the opening tag until the end of the 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
Below is a visualization of an HTML page structure:
HERE,
<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.
<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
EXAMPLE:- Example Explained
Note: Some HTML elements have no content (like the <br> element). These
elements are called empty elements. Empty elements do not have an end tag!
What is an HTML Element?
An HTML element is defined by a start tag, some content, and an end tag:
<tagname> Content goes here... </tagname>
The HTML element is everything from the start tag to the end tag:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
Features of HTML:
Advantages:
● HTML is used to build websites.
● It is supported by all browsers.
● It can be integrated with other languages like CSS, JavaScript, etc.
Characteristics of HTML:
● Easy to understand: It is the most straightforward language you can say, very easy to grasp and easy to develop.
● Flexibility: This language is so flexible that you can create whatever you want, a flexible way to design web
pages along with the text.
● Linkable: You can make clickable text like users can connect from one page to another page or website through
these characteristics.
● Limitless features: You can add videos, gifs, pictures, or sound anything you want that will make the website
more attractive and understandable.
● Support: You can use this language to display the documents on any platform like Windows, Linux, or Mac.
● Not a Programming Language: HTML is not a programming language as it is only concerned with presenting
the information on the web. It is not used to program any logic but to give structure and semantical meaning to
our website. Though we can link JavaScript code to it which is a programming language.
● Language Support: HTML can support various other languages like JavaScript, Ruby, PHP, Perl, and many
more. You can also able to run embed python during the runtime.
Advantages of HTML:
● HTML is easy to learn, easy to apply and it’s totally free you will just need a
text editor and a browser.
● HTML is supported by all the browsers and it is the most friendly search
engine.
● HTML can easily integrate with other languages and is easy to develop.
● It is the basis of all programming languages and the lightest language ever.
● In HTML the display changes frequently depending on the window size or
the device size making it comfortable to read by the user.
HTML EDITORS:-
HTML text editors are used to create and modify web pages. HTML codes can be
written in any text editors including the notepad. One just needs to write HTML in
any text editor and save the file with an extension “.html”.
Step 1: Open Notepad (PC)
Save the file on your computer. Select File > Save as in the Notepad menu.
Name the file “filename.html"
Open the saved HTML file in your favourite browser (double click on the file, or
right-click - and choose "Open with").
HTML Coding
OUTPUT
HTML STRUCTURE AND TAGS:-
In this chapter we will show some basic HTML examples.
HTML Documents
All HTML documents must start with a document type declaration: <!
DOCTYPE html>.
The HTML document itself begins with <html> and ends with
</html>.
The visible part of the HTML document is between <body> and
</body>.
Sample Program:-
<!DOCTYPE html> 1. The <!DOCTYPE> Declaration .The
<html> <!DOCTYPE>declaration represents
the document type, and helps
<body>
browsers to display web pages
correctly. It must only appear once,
<h1>My First Heading</h1> at the top of the page (before any
<p>My first paragraph.</p> HTML tags).
Syntax:
<h1></h1>
<h3></h3>
<h6></h6>
Importance of Heading:
Search Engines use headings for indexing the structure and content of the
webpage.
Headings are used for highlighting important topics.
They provide valuable information and tell us about the structure of the
document.
This example illustrates the HTML
heading tags.
OUTPUT
<!DOCTYPE html>
<html>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>
Horizontal rule:
The <hr> tag which stands for the horizontal rule is used to define a thematic
The <hr> tag is an empty tag, and it does not require an end tag. It is basically
<h2>Heading 2</h2>
<p>I like CSS.</p>
Syntax:-
<p> Content </p>
1. In this example, we are using the <p> tag that is used for paragraphs in
HTML.
<!DOCTYPE html>
<html>
<body>
<h2>Welcome To SISTEC</h2>
</body>
</html>
2.This example explains the HTML <p> tag.
<!DOCTYPE html>
<html>
<body>
</body>
</html>
3.This example explains the HTML <p> tag having multiple lines.
<!DOCTYPE html>
<html>
<body>
<p>
This paragraph has multiple lines.
But HTML reduces them to a single line,
omitting the carriage return we have used.
</p>
<p>
This paragraph has multiple spaces.
But HTML reduces them all to a single
space, omitting the extra spaces and line we have used.
</p>
</body></html>
Break Tag:-<br> tag: There is a way to let the HTML know where the browser
needs to change the lines by using the <br> tag.
These tags do not have any closing tag. So, just a single opening tag will change
the line.
Syntax: <br>
Example: This example explains the <br> tag inside the <p> tag to add the
line-break
<body>
<p>
This paragraph has multiple
<br />lines. But HTML reduces them
<br />to a single line, omitting
<br />the carriage return we have used.
</p>
</body>
</html>
Align attribute: The <p> tag specifically supports the alignment attribute and
allows us to align our paragraphs in left, right, or center alignment.
Syntax:
<p align="value">
Example: This example explains the align attribute to align the content in the
<p> tag.
<!DOCTYPE html>
<html>
<body>
<p align="center">Hello students</p>
<p align="left">A Computer Science portal for students.</p>
<p align="right">It contains well written, well thought articles.</p>
</body>
</html>
New Line :- Creating a new line in HTML code. If you are writing the HTML,
you can create a new line using the <br> (break) tag, as shown in the example
below. The HTML <br> element defines a line break.
Use <br> if you want a line break (a new line) without starting a new paragraph
Example OUTPUT
<!DOCTYPE html>
<html> This is
<body> a paragraph
with line breaks.
<p>This is<br>a paragraph<br>with line breaks.</p>
</body>
</html>
Day 1:- Session- 2
● Formatting Tags
● Style tag
In this Section, we will know HTML Text Formatting, & will understand
various ways of formatting the text.
HTML facilitates the ability for formatting text just like we do in MS Word or
any text editing software. We will go through a few such options.
HTML Formatting Elements
<h2>Welcome To Sistec</h2>
<!--Text in Strong-->
<strong>Hello Students</strong>
<br>
<!--Text in small-->
<small>Hello Students</small>
<br>
<!--Text in Highlight-->
<mark>Hello Students</mark>
</body>
</html>
2. HTML Styles
Colors are used to make the page more attractive. Here are the different styles
which can be used to create new colors by combination of different colors. The
HTML style attribute is used to add styles to an element, such as color, font, size,
and more
Style Tag Example:-
OUTPUT
<!DOCTYPE html>
<html>
<body>
<p>I am normal</p>
<p style="color:red;">I am red</p>
<p style="color:blue;">I am blue</p>
<p style="font-size:50px;">I am big</p>
</body>
</html>
HTML Colour Coding
HTML colors are specified with predefined color names, or with RGB, HEX,
HSL, RGBA, or HSLA values.
Color Names. In HTML, a color can be specified by using a color name:
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:Tomato;">Tomato</h1>
<h1 style="background-color:Orange;">Orange</h1>
<h1 style="background-color:DodgerBlue;">DodgerBlue</h1>
<h1 style="background-color:MediumSeaGreen;">MediumSeaGreen</h1>
<h1 style="background-color:Gray;">Gray</h1>
<h1 style="background-color:SlateBlue;">SlateBlue</h1>
<h1 style="background-color:Violet;">Violet</h1>
<h1 style="background-color:LightGray;">LightGray</h1>
</body>
</html>
OUTPUT
Background Color
You can set the background color for HTML elements OUTPUT
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:DodgerBlue;">What is Computer</h1>
<p style="background-color:Tomato;">
a device, usually electronic, that processes data according to a set of instructions.
The digital computer stores data in discrete units and performs arithmetical and
logical operations at very high speed.
</p>
</body><html>
Text Color
You can set the color of text:
<!DOCTYPE html>
<html>
<body>
</body>
OUTPUT
Border Color
</body>
</html>
4.Anchor (Hyperlinks)
What is a link?
It is a connection from one web resource to another. A link has two ends, An
anchor and direction. The link starts at the “source” anchor and points to the
“destination” anchor, which may be any Web resource such as an image, a
video clip, a sound bite, a program, an HTML document or an element within
an HTML document.
You will find many websites or social media platforms ( Like YouTube,
Instagram ) which link an image to a URL or a text to a URL etc.
This basically means that by using the ‘a’ tag, you can link 1 element of the
code to another element that may/may not be in your code.
HTML Link Syntax
The HTML <a> tag defines a hyperlink.
It has the following syntax: Links are specified in HTML using the “a” tag.
<a href="url">link text</a>
The most important attribute of the <a> element is the href attribute, which
indicates the link's destination.
The link text is the part that will be visible to the reader.
Clicking on the link text, will send the reader to the specified URL address.
Syntax Explanation:
href : The href attribute is used to specify the destination address of the link
used. "href" stands for Hypertext reference.
Text link : The text link is the visible part of the link. It is what the viewer clicks
on.
Example
<!DOCTYPE html>
<html>
<body>
<h1>HTML Links</h1>
</body>
</html>
HTML Links - Use an Image as a Link
<!DOCTYPE html>
<html>
<body>
<h2>Image as a Link</h2>
</body>
</html>