Unit 01 Introduction to HTML
Unit 01 Introduction to HTML
Introduction to HTML
HTML (HyperText Markup Language) is the standard language used to create and design
websites. It is used to structure content on the web by defining the elements on a page such as
headings, paragraphs, links, images, tables, forms, and more. HTML uses a system of "tags" to
define different types of content and their structure within a web page.
Web Pages
Web Site
Web Browsers
Search Engine.
1. World Wide Web (WWW)
The World Wide Web (WWW) is a system of interlinked hypertext documents and multimedia
content accessed via the Internet. It is often referred to simply as "the Web." It was created in
1989 by Tim Berners-Lee, and it enables users to browse and interact with content, such as text,
images, videos, and links to other pages, all through web browsers.
The WWW relies on the Internet for communication, which is a vast global network of
computers and servers connected by communication protocols (primarily TCP/IP).
2. Web Pages
A Web Page is a single document on the World Wide Web that can be viewed in a web browser.
It is typically written in HTML (HyperText Markup Language) and can contain text, images,
videos, links, and other multimedia elements. A web page is part of a larger collection of related
pages called a website.
Static Web Page: A page with fixed content that doesn't change unless manually updated.
Dynamic Web Page: A page whose content can change based on user interaction or time (e.g.,
real-time data from a server).
3. Web Site
A Website is a collection of related web pages that are typically identified by a common domain
name (such as www.example.com). Websites are hosted on web servers and are accessed by users
through web browsers. A website can contain many pages, such as home pages, contact pages,
blogs, and product pages.
A website might consist of several web pages, images, and other digital assets, structured using
folders and files.
4. Web Browsers
A Web Browser is a software application used to access and navigate the World Wide Web.
Browsers interpret and display web pages written in HTML, CSS, and JavaScript. Examples of
popular web browsers include:
Google Chrome
Mozilla Firefox
Safari
Microsoft Edge
Opera
When you enter a URL (Uniform Resource Locator) into the browser's address bar, the browser
sends a request to the server that hosts the webpage and displays the requested content.
5. Web Servers
A Web Server is a computer that hosts a website and serves web pages to users' browsers. It
processes requests from browsers (for example, when a user types in a URL) and sends the
appropriate web pages, images, or other resources back to the client.
Web servers run software like Apache, Nginx, or Microsoft IIS (Internet Information Services).
Web servers work using HTTP (Hypertext Transfer Protocol) or HTTPS (HTTP Secure) to
transfer data.
Static Websites:
o These are simpler websites where the content is fixed and doesn’t change unless
manually updated by the website owner.
o Typically built using HTML, CSS, and sometimes JavaScript.
o Examples: Personal blogs, portfolios, or informational websites.
o Advantages: Faster load times, lower cost to develop and host, easier to maintain.
Dynamic Websites:
o These websites display content that changes based on user interaction or real-time data.
They often rely on server-side programming languages (PHP, Node.js, Python) and
databases (MySQL, MongoDB).
o Examples: Social media platforms, e-commerce sites, and news portals.
o Advantages: Can provide personalized content, better interactivity, and dynamic features
like user logins, comment sections, etc.
8. Search Engine
A Search Engine is a web-based tool that allows users to search for information on the internet.
Search engines index billions of web pages and return the most relevant results based on a user's
query. Some well-known search engines include:
DOCTYPE, HTML, TITLE,HEAD, BODY and other meta tags with attributes.
1. DOCTYPE
Definition: The DOCTYPE declaration is the very first thing in an HTML document. It
tells the web browser what version of HTML the page is using. This helps ensure that the
page is rendered correctly and consistently across different browsers.
Syntax:
<!DOCTYPE html>
Explanation:
2. <html> Element
Definition: The <html> tag is the root element of an HTML document. All other elements
(like <head> and <body>) are contained within it.
Syntax
<html lang="en">
</html>
Explanation:
The <html> element wraps the entire document and contains all other HTML elements.
The lang attribute specifies the language of the document's content. For example, lang="en"
indicates that the document is in English. This is useful for accessibility and search
engines.
3. <head> Element
Definition: The <head> section contains meta-information about the HTML document,
such as the title, character encoding, linked resources (like stylesheets or scripts), and
other metadata.
Syntax:
<head>
</head>
Explanation:
The <head> element doesn't directly display content on the web page but provides
important information that helps the browser interpret the content correctly.
Key elements inside the <head> include <meta>, <title>, <link>, and <script> tags.
4. <title> Element
Definition: The <title> tag defines the title of the web page. This title is displayed in the
browser's title bar or tab, and it is also used by search engines when indexing the page.
Syntax:
The content inside the <title> tag should be descriptive and relevant to the content of the
page. It plays a key role in search engine optimization (SEO).
Example: <title>Best Web Design Practices - Web Development Guide</title>
5. . <body> Element
Definition: The <body> tag contains all the visible content of a web page. This is what
users see when they load a page in their browser, including text, images, videos, forms,
etc.
Syntax:
<body>
</body>
Explanation:
The <body> section is where all the elements that users interact with on the page are
placed. It contains headings, paragraphs, images, links, lists, forms, and other interactive
content.
6. <meta> Tags
Definition: <meta> tags provide metadata about the document, such as the character set,
author, description, keywords, and viewport settings. They are typically placed inside the
<head> section.
Explanation: UTF-8 is the most commonly used character encoding for modern web pages, supporting a
wide range of characters from different languages
Description:
Provides a brief description of the page's content, often used by search engines to
display a snippet in search results.
Explanation: This is important for SEO as search engines may use it to display a summary of the
page in search results.
Headings, Paragraphs, Breaks, Divisions, Centered Text, Block Quotes, Preformatted text, types
of Address, HR tag. Horizontal Rue.
In HTML, elements are categorized as either block-level elements or inline elements. Block-
level elements are typically used to structure the layout of a web page, as they create a new block
of content that occupies the full width of its container (like a box). These elements generally start
on a new line and extend to the full width available.
1. Headings (<h1> to <h6>)
Definition: Headings are used to define titles or subtitles on a web page. HTML provides
six levels of headings, with <h1> being the most important and <h6> being the least.
Syntax:
<h1>Main Heading</h1>
<h2>Subheading</h2>
<h3>Sub-subheading</h3>
Explanation:
<h1> is typically used for the main title of the page (and should ideally be used once per
page for SEO purposes).
<h2> to <h6> represent subheadings, with decreasing importance.
Block-level: Headings create a new block of content and each heading starts on a new
line.
2. Paragraph (<p>)
Definition: The <p> tag defines a paragraph of text. It automatically adds some space
above and below the content.
Syntax:
Explanation:
The <p> element is commonly used for wrapping text that forms a distinct paragraph.
Block-level: The paragraph element occupies the full width of its container and is
separated from other elements with space.
3. Line Break (<br>)
Definition: The <br> tag is used to insert a line break within text, forcing the content to
continue on the next line.
Syntax: <p>This is the first line.<br>This is the second line.</p>
Explanation:
4. Division (<div>)
Definition: The <div> tag is a block-level container element used to group content
together. It doesn’t add any visual formatting by itself, but it is commonly used for layout
purposes with CSS or JavaScript.
Syntax:
<div>
<h2>Section Title</h2>
</div>
Explanation:
<div> is typically used to wrap multiple elements or sections of a page, making it easier to
apply styling or manipulate the content through JavaScript.
It is block-level, so it creates a block box around its content.
5. Centered Text (<center>)
Definition: The <center> tag was used in earlier HTML versions to horizontally center-
align text or other elements. However, it is deprecated in HTML5, and CSS should be
used for centering content instead.
Syntax (deprecated):
6. Blockquote (<blockquote>)
Definition: The <blockquote> tag is used to define a block of text that is a quotation from
another source. It typically appears indented to show that the text is a direct quote.
Syntax: <blockquote>
</blockquote>
Explanation:
The text inside the <blockquote> element is usually indented, making it visually distinct
from the rest of the content. It is often used for long quotes or citations.
Block-level: A blockquote occupies the full width of its container and is often indented
on the left.
Syntax: <pre>
This text
preserves spacing
and formatting.
</pre>
Explanation:
Text inside the <pre> tag is displayed exactly as it is written, including spaces and line
breaks.
Block-level: The content inside the <pre> element is displayed in a monospaced font,
which is often used for code snippets or formatting-sensitive text.
8. Address (<address>)
Definition: The <address> tag is used to provide contact information for the author or
owner of a document or website.
Syntax:
<address>
<a href="mailto:[email protected]">[email protected]</a>
</address>
Explanation:
Definition: The <hr> tag creates a horizontal line (or rule) across the page, typically used
to separate content visually.
Syntax:
<hr>
Explanation:
The <hr> tag is self-closing, and it creates a horizontal line that extends across the full
width of its container.
It is often used for separating sections of content (such as between different topics in an
article or between paragraphs).
The appearance of the horizontal line can be customized with CSS (e.g., thickness, color,
style).
Text-level elements are used to style and format text within a block-level structure without
creating a new block. These elements usually work inline, meaning they do not break the flow of
content or create new lines. Text-level elements are crucial for adding emphasis, styling, and
formatting individual parts of text within paragraphs or other content.
1. Bold (<b>)
Definition: The <b> tag makes the enclosed text bold. It is purely for styling and does not
imply any special importance or emphasis semantically.
Syntax:
Explanation:
The text within the <b> tag will appear bold on the screen, but it doesn't carry any
semantic meaning about the importance of the text.
Modern use: For semantic emphasis, it's often recommended to use the <strong> tag
instead of <b>, as <strong> indicates that the text is of strong importance.
2. Italic (<i>)
Definition: The <i> tag is used to italicize text. Like the <b> tag, <i> is a styling element
but does not convey any semantic meaning.
Syntax:
Explanation:
The text inside the <i> tag will be displayed in an italic font.
Modern use: For semantic meaning, it’s better to use the <em> tag instead of <i>, as <em>
indicates emphasized text (typically displayed in italics).
Definition: The <tt> tag was used in older HTML versions to display text in a
monospaced (teletype) font. It is now deprecated in HTML5 and is replaced by CSS font-
family with a monospace font.
Syntax: <tt>This text is displayed in a monospace font.</tt>
Explanation:
Text within the <tt> tag will appear in a monospaced font, where each character takes up
the same amount of space.
4. Underline (<u>)
Explanation:
Text inside the <u> tag will be displayed with a line beneath it.
Modern use: The <u> tag is often used for emphasis in special cases (e.g., hyperlinks),
but for general text styling, it's often recommended to use CSS text-decoration for
underlining.
5. Strikethrough (<s>)
Definition: The <s> tag indicates text that has been struck through or deleted. It visually
shows the text with a line through it.
Syntax:<s>This text is struck through.</s>
Explanation:
6. Superscript (<sup>)
Definition: The <sup> tag is used to display text as superscript (above the normal text
line), commonly used for mathematical expressions, footnotes, or exponents.
Syntax: E = mc<sup>2</sup>
Explanation:
Text inside the <sup> tag appears smaller and raised above the baseline. It's often used for
exponents in formulas or to represent footnotes.
Example: The equation for energy in physics, E=mc2E = mc^2E=mc2, uses superscript
for the exponent.
7. Subscript (<sub>)
Definition: The <sub> tag is used to display text as subscript (below the normal text line),
commonly used for chemical formulas or indices in math.
Syntax: H<sub>2</sub>O
Explanation:
o Text inside the <sub> tag appears smaller and placed below the baseline. It's
commonly used for representing subscripts in chemical formulas (e.g., water,
H2OH_2OH2O).
8. Division (<div>)
Definition: The <div> tag is used as a container for grouping block-level content.
Although it is a block-level element, it is commonly used for layout purposes and styling.
It does not have a specific semantic meaning, but it is useful for grouping content for
styling and scripting.
Syntax:
<div>
<h1>Title</h1>
</div>
Explanation:
o The <div> tag is often used to wrap multiple block-level elements and apply styles
or layouts to them using CSS. It helps with organization and separation of content
on a page.
Syntax:
Explanation:
These entities are used to represent characters that have special meanings in HTML or
that cannot be typed directly in the code.
Definition: HTML comments are used to add notes or explanations within the HTML
code. They are not displayed in the browser and serve only for documentation purposes.
Syntax:
<!-- This is a comment and will not appear in the browser -->
Explanation:
Comments are enclosed within <!-- and -->.
Comments are useful for documenting sections of code, leaving reminders, or
temporarily disabling parts of the code during development.
Note: Comments are not visible to users in the web page's output.
<s> Strikes through the text (used for deleted text). <s>This text is struck through.</s>
Special Display characters that cannot be typed directly in &, <, >, ©
characters HTML.
<!-- --> Adds comments in the code that are not displayed <!-- This is a comment -->
in the browser.