0% found this document useful (0 votes)
15 views

HTML

Uploaded by

deepadhibar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

HTML

Uploaded by

deepadhibar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

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.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>

The <!DOCTYPE html> declaration defines that this document is an HTML5


document

The <html> element is the root element of an HTML page

The <head> element contains meta information about the HTML page

The <title> element specifies a title for the HTML page (which is shown in
the browser’s title bar or in the page’s tab)

The <body> element defines the document’s body, and is a container for
all the visible contents, such as headings, paragraphs, images, hyperlinks,
tables, lists, etc.

The <h1> element defines a large heading

The <p> element defines a paragraph

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>


Start tag Element content End tag

<h1> My First Heading </h1>

<p> My first paragraph. </p>

<br> none none

HTML Headings

HTML headings are defined with the <h1> to <h6> tags.

<h1> defines the most important heading. <h6> defines the least
important heading:

Example

<h1>This is heading 1</h1>

<h2>This is heading 2</h2>

<h3>This is heading 3</h3>

HTML Paragraphs

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.w3schools.com>This is a link</a>

HTML Images

HTML images are defined with the <img> tag.

The source file (src), alternative text (alt), width, and height are provided
as attributes:

Example

<img src=”w3schools.jpg” alt=”W3Schools.com” width=”104”


height=”142”>

HTML Attributes

All HTML elements can have attributes


Attributes provide additional information about elements

Attributes are always specified in the start tag

Attributes usually come in name/value pairs like: name=”value”

The href Attribute

The <a> tag defines a hyperlink. The href attribute specifies the URL of
the page the link goes to:

Example

<a href=https://www.w3schools.com>Visit W3Schools</a>

The src Attribute

The <img> tag is used to embed an image in an HTML page. The src
attribute specifies the path to the image to be displayed:

Example

<img src=”img_girl.jpg”>

HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C#
BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS
NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO
KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE

HTML Attributes

HTML attributes provide additional information about HTML elements.

HTML Attributes

All HTML elements can have attributes

Attributes provide additional information about elements

Attributes are always specified in the start tag

Attributes usually come in name/value pairs like: name=”value”

The href Attribute

The <a> tag defines a hyperlink. The href attribute specifies the URL of
the page the link goes to:

Example

<a href=https://www.w3schools.com>Visit W3Schools</a>

You will learn more about links in our HTML Links chapter.

The src Attribute


The <img> tag is used to embed an image in an HTML page. The src
attribute specifies the path to the image to be displayed:

Example

<img src=”img_girl.jpg”>

There are two ways to specify the URL in the src attribute:

1. Absolute URL – Links to an external image that is hosted on another


website. Example:
src=https://www.w3schools.com/images/img_girl.jpg.

Notes: External images might be under copyright. If you do not get


permission to use it, you may be in violation of copyright laws. In addition,
you cannot control external images; it can suddenly be removed or
changed.

2. Relative URL – Links to an image that is hosted within the website.


Here, the URL does not include the domain name. If the URL begins
without a slash, it will be relative to the current page. Example:
src=”img_girl.jpg”. If the URL begins with a slash, it will be relative
to the domain. Example: src=”/images/img_girl.jpg”.

The width and height Attributes

The <img> tag should also contain the width and height attributes,
which specify the width and height of the image (in pixels):

Example

<img src=”img_girl.jpg” width=”500” height=”600”>

The alt Attribute

The required alt attribute for the <img> tag specifies an alternate text for
an image, if the image for some reason cannot be displayed. This can be
due to a slow connection, or an error in the src attribute, or if the user
uses a screen reader.

Example

<img src=”img_girl.jpg” alt=”Girl with a jacket”>

The title Attribute

The title attribute defines some extra information about an element.

The value of the title attribute will be displayed as a tooltip when you
mouse over the element:

Example
<p title=”I’m a tooltip”>This is a paragraph.</p>

Single or Double Quotes?

Double quotes around attribute values are the most common in HTML, but
single quotes can also be used.

In some situations, when the attribute value itself contains double quotes,
it is necessary to use single quotes:

<p title=’John “ShotGun” Nelson’>

Or vice versa:

<p title=”John ‘ShotGun’ Nelson”>BASICS OF HTML

1. <html></html>
2. <h1></h1>
3. <p></p>
4. <b></b>

5.<i></i>

6.<ul></ul>

7. <ol> </ol>

8. <li></li>

9. <form></form>

10. <table></table>

11. <a href=”url”></a>

12. <img src=”url” />

13. src=”url”

14. <br>

15. <hr>

Explanation

START AND END DOCUMNET

HEADING TAGS (HI TO H6)

PARAGRAPH TAG

BOLD TEXT TAG

ITALIC TAG

UN-ORDER LIST TAG


ORDER LIST TAG

LIST ITEMS TAG

BASIC FORM TAG

TABLE TAG

BASIC LINK TAG

IMAGE TAG

SOURCE PATH (URL / FILE NAME)

LINE BREAK TAG

HORIZONTAL LINE TAG

Tag

<html> ... </html>

<head> ... </head>

<title> ... </title>

Description

Declares the Web page to be written in HTML

Delimits the page’s head

Defines the title (not displayed on the page)

<body> ... </body>

Delimits the page’s body

</center> <center>

<h n> ... </hn>

<b> ... </b>

<i> ... </i>

<ul>... </ul>

<ol> ... </ol>

<li> ... </li>


<br>

<p>

<hr>

<img src=”...”>

<a href=”...”> ... </a>

Starts a paragraph

Inserts a horizontal rule

Displays an image here

Defines a hyperlink

Delimits a level n heading

Set ... in boldface

Set... in italics

Center on the page horizontally

Brackets an unordered (bulleted) list

Brackets a numbered list

Brackets an item in an ordered or numbered list

Forces a line break here

You might also like