Professional Documents
Culture Documents
NANCY SUKHADIA
HTML document contains the text (the content of the page) with embedded tags, which
provide instruction, appearance and function of the content.
The HTML document is divided into two major portions: the head and the body.
The head contains information about the document such as the title and "meta" information
describing the content.
The body contains the actual contents of the document (the parts that is displayed in the
browser window).
The following examples show the tags that make up the standard structure of an HTML
document:
1
MADE BY : MS. NANCY SUKHADIA
Example:
< ! DOCTYPE html>
<Html>
<Head>
<Title>The first example </Title>
</Head>
<Body>
Welcome to HTML
</Body>
</Html>
2
MADE BY : MS. NANCY SUKHADIA
Example:
<p>(Paragraph)
The <p> tag defines a paragraph.
Browsers automatically add a single blank line before and after each <p> element.
Example:
<br>(BreakLine)
The <br> tag inserts a single line break.
The <br> tag is useful for writing addresses or poems.
The <br> tag is an empty tag which means that it has no end tag.
Example:
<a> (anchor)
The <a> tag defines a hyperlink, which is used to link from one page to another.
The most important attribute of the <a> element is the href attribute, which
indicates the link's destination.
By default, links will appear as follows in all browsers:
An unvisited link is underlined and blue
A visited link is underlined and purple
An active link is underlined and red
Notes:
If the <a> tag has no href attribute, it is only a placeholder for a hyperlink.
A linked page is normally displayed in the current browser window, unless you
specify another target.
Example:
<a href="https://www.google.com">
google </a>
<img>
The <img> tag is used to embed an image in an HTML page.
Images are not technically inserted into a web page; images are linked to web pages.
The <img> tag creates a holding space for the referenced image.
The <img> tag has two required attributes:
height- attribute specifies the height of an image, in pixels.
width-attribute specifies the width of an image, in pixels.
src - Specifies the path to the image
alt - Specifies an alternate text for the image, if the image for some reason cannot be
displaye
4
MADE BY : MS. NANCY SUKHADIA
Example:
<html>
<body>
<img src="html.svg"
alt="html" width="45" height="45">
</img>
</body>
</html>
alt
The required alt attribute specifies an alternate text for an image, if the image cannot be
displayed.
The alt attribute provides alternative information for an image if a user for some reason
cannot view it (because of slow connection, an error in the src attribute, or if the user
uses a screen reader).
Syntax:
<img alt="text">
Example:
<html>
<body>
<img alt="html"> </img>
</body>
</html>
href
The href attribute specifies the URL of the page the link goes to.
If the href attribute is not present, the <a> tag will not be a hyperlink.
style
The <style> tag is used to define style information (CSS) for a document.
5
MADE BY : MS. NANCY SUKHADIA
Inside the <style> element you specify how HTML elements should render in a
browser.
Example:
<html>
<head> This is a heading
<style>
h1 {color:red;} This is a paragraph.
p {color:blue;}
</style>
</head>
<body>
<h1>A heading</h1>
<p>A paragraph.</p>
</body>
</html>
title
The <title> tag defines the title of the document. The title must be text-only, and it is
shown in the browser's title bar or in the page's tab.
The <title> tag is required in HTML documents!
The <title> element:
defines a title in the browser toolbar
provides a title for the page when it is added to favorites
displays a title for the page in search-engine results
<html>
<body>
<title> My First Page </title>
</body>
</html>
id
The id attribute specifies a unique id for an HTML element (the value must be unique
within the HTML document).
The id attribute is most used to point to a style in a style sheet to manipulate the
element with the specific id.
Example:
<!DOCTYPE html>
<html>
<head>
<style>
#geeks {
color: green;
}
</style>
</head>
6
MADE BY : MS. NANCY SUKHADIA
<body>
<h2>Welcome to GeeksforGeeks</h2>
<h1 id="geeks">Hi Geeks!</h1>
</body>
</html>
The <head> element is a container for metadata (data about data) and is placed
between the <html> tag and the <body> tag.
Metadata is data about the HTML document. Metadata is not displayed.
Metadata typically define the document title, character set, styles, scripts, and other
meta information. (Example Mention in Page no.2)
Example:
<html>
<head>
<title> Text Formatting </title>
</head>
<body>
<b> Bold</b> <br>
<i> Italic </i> <br>
<strong> strong </strong> <br>
<em> Emphasis</em> <br>
<small> small </small> <br>
<ins> Insert </ins> <br>
H<sub> 2 </sub> O <br>
<mark> Mark </mark> <br>
a <sup> 2 </sup> <br>
<del> Delete </del> <br>
</body>
</html>