You are on page 1of 50

Focus Abhishek you can do it …

HTML

Html stands for Hyper Text Markup Language. Html mainly use for design a client side web pages, this

is a static page it means you can only view Html page not give request and not get response from

server. Using Html pages browser get user information through form (This is an Html element). Html

provides so many elements (like <p>, <img>, <h1>) to design a web page.

Hypertext: Hyper Text simply means "Text within Text". A text has a link within it. The
hypertext pages are interconnected by hyperlinks, when mouse click on these link which brings you to a

new webpage. A language that is used to define elements in a document or Web page by embedding codes (tags) surrounded by
common start and stop characters. For example, the tags in SGML, HTML, XML and WML all use the less-than
symbol (<) to start the tag and a greater-than symbol (>) to end it.

Markup language: Any tag based language known as markup language, for example gml, sgml, html,

xml etc.

Tim Berners-Lee
Focus Abhishek you can do it …

Tim Berners-Lee is known as father of Html. The first publicly available description of HTML was a document called "HTML

Tags", first described, on the Internet by Berners-Lee in late 1991.

Features for Html

 Html is a static page.

 Html is not a case sensitive.

 Html is a error free language.

 Html is simple and easy language.

 It provides facilities to add audio, video, image on web pages.

 Html is platform independent language, it can be run on any platform like window, linux, Mac.

 Each and every elements of html should be enclosed within the angular brackets (<>).

 Html programs are executed by the interpreter of the browser software.

 Html program save with .htm or .html extension.

 The current version of Html is Html 5.0


HTML TAG
Html Tag

 Html Tag HTML tags contain three main parts: opening tag, content and closing tag.
But some HTML tags are unclosed tags.
 Syntax

 <tag> content </tag>  <tag> content </tag>

 HTML tags normally come in pairs like <p> and </p>


 The end tag is written like the start tag, but with a forward slash inserted before the tag
name


 HTML Tag Examples

 Note: HTML is not case sensitive language so you can write Html Tags in lowercase or uppercase letters. Some Html

tags are given below;


 Syntax

 <p>
Focus Abhishek you can do it …

 Paragraph Tag

 </p>


 <h2>

 Heading Tag

 </h2>


 <b>Bold Tag</b>


 <u>Underline Tag</u>


 <i>Italic Tag </i>

 Unclosed Html Tags

 Some Html tags are not closed, for example<br>, <hr>, <img> etc.

 <br> Tag: br stands for break line, it breaks the line of the code.

Html br tag

<br> tag are use for give the line break within any text line.
Example

<html>

<body>

<p>This is my first html code and now <br/> I am happy.</p>

</body>

</html>

Result

This is my first html code and now

I am happy.

<Note: ><br> tag no need to close the <br> tag.

 <hr> Tag: hr stands for Horizontal Rule. This tag is used to put a line across the webpage.
 Html hr tag

 <hr> (Horizontal Rules) tag are used for to create a horizontal line on html page. <hr> are used for separate the content

on html page.
Focus Abhishek you can do it …

 Example

 <p>This is simple html page<p>

 <hr/>

 <p>Html is simple and easy to learn<p>

 Result

 This is simple html page

 Html is simple and easy to learn

 <img> Tag: img tag are use for display image on web page.

 HTML Meta Tags


 DOCTYPE, title, link, meta and style

Meta tag
<meta> tag provides all information related to web page like author name, keyword for search engine, description about what things page contain. By using

meta tag (<meta>) you can also refresh your web page within regular interval of time.
Example

<html>

<head>

<meta name="keywords" content="html tutorial"/>

<meta name="description" content="Html is easy to learn"/>

<meta content="index, follow" name="Robots"/>

<meta content="Tutorial4us.com" name="author"/>

<meta http-equiv="refresh" content="30"/>

</head>

<body>

<p>My first web page</p>

</body>

</html>

Html Style meta Tag

<style> tag are used for define CSS styles required for the page. It must be inside the <head> tag.
Syntax
Focus Abhishek you can do it …

<!DOCTYPE>

<html>

<style>

.para

color:red;

<style>

<body>

<p class="para">This is my first Html code.</p>

</body>

</html>

 HTML Text Tags


 <p>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <strong>, <em>, <abbr>, <acronym>, <address>,
<bdo>, <blockquote>, <cite>, <q>, <code>, <ins>, <del>, <dfn>, <kbd>, <pre>, <samp>, <var>
and <br>

 HTML Link Tags
 <a> and <base>

 HTML Image and Object Tags
 <img>, <area>, <map>, <param> and <object>

 HTML List Tags
 <ul>, <ol>, <li>, <dl>, <dt> and <dd>

 HTML Table Tags
 table, tr, td, th, tbody, thead, tfoot, col, colgroup and caption

 HTML Form Tags
 form, input, textarea, select, option, optgroup, button, label, fieldset and legend

 HTML Scripting Tags
 script and noscript

A Simple HTML Document


Focus Abhishek you can do it …

Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>

Try it Yourself »

Example Explained

 The <!DOCTYPE html> declaration defines this document to be HTML5


 The <html> element is the root element of an HTML page
 The <head> element contains meta information about the document
 The <title> element specifies a title for the document
 The <body> element contains the visible page content
 The <h1> element defines a large heading
 The <p> element defines a paragraph

Web Browsers
The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them.

The browser does not display the HTML tags, but uses them to determine how to display the document:

Title tag
<title> tag are used for provide the title of you web page. Title are show top of the web page. Title tag

are most useful in case of seo. Using page title search engine easily find you page on web. Each page

should have a unique title.


Focus Abhishek you can do it …

Result

HTML Page Structure


Below is a visualization of an HTML page structure:
Focus Abhishek you can do it …

<html>

<head>

<title>Page title</title>

</head>

<body>

<h1>This is a heading</h1>

<p>This is a paragraph.</p>

<p>This is another paragraph.</p>

</body>

</html>

Note: Only the content inside the <body> section (the white area above) is displayed in a browser.

The <!DOCTYPE> Declaration


The <!DOCTYPE> declaration represents the document type, and helps browsers to display web pages
correctly.

It must only appear once, at the top of the page (before any HTML tags).

The <!DOCTYPE> declaration is not case sensitive.

The <!DOCTYPE> declaration for HTML5 is:

<!DOCTYPE html>

HTML Versions
Since the early days of the web, there have been many versions of HTML:

Version Year

HTML 1991

HTML 2.0 1995

HTML 3.2 1997


Focus Abhishek you can do it …

HTML 4.01 1999

XHTML 2000

HTML5 2014

HTML Links
HTML links are defined with the <a> tag:

Example
<a href="https://www.w3schools.com">This is a link</a>

Try it Yourself »

The link's destination is specified in the href attribute.

Attributes are used to provide additional information about HTML elements.

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">

Try it Yourself »

HTML Formatting

HTML Formatting

HTML Formatting is a process of formatting text for better look and feel. There are many formatting
tags in HTML. These tags are used to make text bold, italicized, or underlined. There are almost 12
options available that how text appears in HTML and XHTML.

Here, we are going to learn 12 HTML formatting tags.


Focus Abhishek you can do it …

1) Bold Text

If you write anything within <b>............</b> element, is shown in bold letters.

See this example:

1. <p> <b>Write Your First Paragraph in bold text.</b></p>


Test it Now

Output:

Write Your First Paragraph in bold text.

2) Italic Text
If you write anything within <i>............</i> element, is shown in italic letters.

See this example:

1. <p> <i>Write Your First Paragraph in italic text.</i></p>


Test it Now

Output:

Write Your First Paragraph in italic text.

3) HTML Marked formatting

If you want to mark or highlight a text, you should write the content within <mark>.........</mark>.

See this example:

1. <h2> I want to put a <mark> Mark</mark> on your face</h2>


Test it Now

Output:

I want to put a Mark on your face


Focus Abhishek you can do it …

4) Underlined Text
If you write anything within <u>.........</u> element, is shown in underlined text.

See this example:

1. <p> <u>Write Your First Paragraph in underlined text.</u></p>


Test it Now

Output:

Write Your First Paragraph in underlined text.

5) Strike Text
Anything written within <strike>.......................</strike> element is displayed with
strikethrough. It is a thin line which cross the statement.

See this example:

1. <p> <strike>Write Your First Paragraph with strikethrough</strike>.</p>


Test it Now

Output:

Write Your First Paragraph with strikethrough.

6) Monospaced Font
If you want that each letter has the same width then you should write the content within
<tt>.............</tt> element.

Note: We know that most of the fonts are known as variable-width fonts because different letters have
different width. (for example: 'w' is wider than 'i'). Monospaced Font provides similar space among
every letter.

See this example:

1. <p>Hello <tt>Write Your First Paragraph in monospaced font.</tt></p>


Test it Now
Focus Abhishek you can do it …

Output:

Hello Write Your First Paragraph in monospaced font.

7) Superscript Text
If you put the content within <sup>..............</sup> element, is shown in superscript ; means it is
displayed half a character's height above the other characters.

See this example:

1. <p>Hello <sup>Write Your First Paragraph in superscript.</sup></p>


Test it Now

Output:

Hello Write Your First Paragraph in superscript.

8) Subscript Text
If you put the content within <sub>..............</sub> element, is shown in subscript ;
means it is displayed half a character's height below the other characters.

See this example:

1. <p>Hello <sub>Write Your First Paragraph in subscript.</sub></p>


Test it Now

Output:

Hello Write Your First Paragraph in subscript.

9) Deleted Text
Anything that puts within <del>..........</del> is displayed as deleted text.

See this example:


Focus Abhishek you can do it …

1. <p>Hello <del>Delete your first paragraph.</del></p>


Test it Now

Output:

Hello Delete your first paragraph.

10) Inserted Text


Anything that puts within <ins>..........</ins> is displayed as inserted text.

See this example:

1. <p> <del>Delete your first paragraph.</del><ins>Write another paragraph.</i


ns></p>
Test it Now

Output:

Delete your first paragraph.Write another paragraph.

11) Larger Text


If you want to put your font size larger than the rest of the text then put the content within
<big>.........</big>. It increase one font size larger than the previous one.

See this example:

1. <p>Hello <big>Write the paragraph in larger font.</big></p>


Test it Now

Output:

Hello Write the paragraph in larger font.

12) Smaller Text


Focus Abhishek you can do it …

If you want to put your font size smaller than the rest of the text then put the
content within <small>.........</small>tag. It reduces one font size than the
previous one.

See this example:

1. <p>Hello <small>Write the paragraph in smaller font.</small></p>


Test it Now

Output:

Hello Write the paragraph in smaller font.

Html div tag


<div> tag are used for group the large section of Html elements together. <div> tag is just like a container which is

used to wrap other Html page elements and divides the Html documents into sections. Suppose on your web page

lot of Html elements like <p>, <h2> and <img> and you want to separate these elements from others elements then

apply <div> tag.

Where use <div> tag

Mostly <div> are used for divide complete page into section like footer, header, left, right section.

Example

<html>
Focus Abhishek you can do it …

<body>

<div style="background:#00FF99">

<h3>Heading inside a div</h3>

<p>Text inside a div element.</p>

</div>

<div style="background:#FFCAFF">

<h3>Heading inside a div</h3>

<p>Text inside a div.</p>

</div>

<div style="background:#66FFFF">

<h3>Heading inside a div</h3>

<p>Text inside a div.</p>

</div>

</body>

</html>

Result

Heading in a div

Text in a div.

Heading in a div

Text in a div.

Heading in a div

Text in a div.

pre tag
<pre> tag are show text on web page as it is written on html page including break line, number of

space. In Html if you enter more than one space between two text it not show on browser only single

space display, for show all given space you need to use <pre> tag.
Focus Abhishek you can do it …

With <pre> tag and without <pre> tag

If we give line brake or number of space between text it ignored by browser only show single space

Example

<html>

<head>

<p>

This is html example

This is pre tag

</p>

</body>

</html>

Result

This is html example This is pre tag

In above example spaces are not display on web page and also not display break line.

<pre> tag are show text on web page as it is written on page including break line, number of space.
Example

<html>

<head>

<pre>

This is html example

This is pre tag

</pre>

</body>

</html>

Result

This is html example


This is pre tag

HTML Attributes
Focus Abhishek you can do it …

Attributes provide additional information about HTML elements.

HTML Attributes
 All HTML elements can have attributes
 Attributes provide additional information about an element
 Attributes are always specified in the start tag
 Attributes usually come in name/value pairs like: name="value"

The href Attribute


HTML links are defined with the <a> tag. The link address is specified in the href attribute:

Example
<a href="https://www.w3schools.com">This is a link</a>

Try it Yourself »

The src Attribute


HTML images are defined with the <img> tag.

The filename of the image source is specified in the src attribute:

Example
<img src="img_girl.jpg">

Try it Yourself »

The width and height Attributes


Images in HTML have a set of size attributes, which specifies the width and height of the image:

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

Try it Yourself »

The image size is specified in pixels: width="500" means 500 pixels wide.
Focus Abhishek you can do it …

The alt Attribute


The alt attribute specifies an alternative text to be used, when an image cannot be displayed.

The value of the attribute can be read by screen readers. This way, someone "listening" to the
webpage, e.g. a blind person, can "hear" the element.

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

Try it Yourself »

The alt attribute is also useful if the image does not exist:

Example

What happens if we try to display an image that does not exist:

<img src="img_typo.jpg" alt="Girl with a jacket">

Try it Yourself »

The style Attribute


The style attribute is used to specify the styling of an element, like color, font, size etc.

Example
<p style="color:red">I am a paragraph</p>

Try it Yourself »

You will learn more about styling later in this tutorial, and in our CSS Tutorial.

The lang Attribute


The language of the document can be declared in the <html> tag.

The language is declared with the lang attribute.

Declaring a language is important for accessibility applications (screen readers) and search engines:

<!DOCTYPE html>
<html lang="en-US">
<body>

...
Focus Abhishek you can do it …

</body>
</html>

The first two letters specify the language (en). If there is a dialect, use two more letters (US).

The title Attribute


Here, a title attribute is added to the <p> element. The value of the title attribute will be displayed as a tooltip when you mouse
over the paragraph:

Example
<p title="I'm a tooltip">
This is a paragraph.
</p>

Try it Yourself »

We Suggest: Use Lowercase Attributes


The HTML5 standard does not require lowercase attribute names.

The title attribute can be written with uppercase or lowercase like title or TITLE.

W3C recommends lowercase in HTML, and demands lowercase for stricter document types like XHTML.

At W3Schools we always use lowercase attribute names.

We Suggest: Quote Attribute Values


The HTML5 standard does not require quotes around attribute values.

The href attribute, demonstrated above, can be written as:

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

Try it Yourself »

W3C recommends quotes in HTML, and demands quotes for stricter document types like XHTML.

Sometimes it is necessary to use quotes. This example will not display the title attribute correctly, because it contains a space:

Example
<p title=About W3Schools>

Try it Yourself »
Focus Abhishek you can do it …

Using quotes are the most common. Omitting quotes can produce errors.
At W3Schools we always use quotes around attribute values.

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">

Chapter Summary
 All HTML elements can have attributes
 The title attribute provides additional "tool-tip" information
 The href attribute provides address information for links
 The width and height attributes provide size information for images
 The alt attribute provides text for screen readers
 At W3Schools we always use lowercase attribute names
 At W3Schools we always quote attribute values with double quotes

Test Yourself with Exercises!


Exercise 1 » Exercise 2 » Exercise 3 » Exercise 4 » Exercise 5 »

HTML Attributes
Below is an alphabetical list of some attributes often used in HTML:

Attribute Description

alt Specifies an alternative text for an image, when the image cannot be displayed

disabled Specifies that an input element should be disabled


Focus Abhishek you can do it …

href Specifies the URL (web address) for a link

id Specifies a unique id for an element

src Specifies the URL (web address) for an image

style Specifies an inline CSS style for an element

title Specifies extra information about an element (displayed as a tool tip)

HTML Heading

HTML Heading

A HTML heading or HTML h tag can be defined as a title or a subtitle which you want to display on the webpage.
When you place the text within the heading tags <h1>.........</h1>, it is displayed on the browser in the bold
format and size of the text depends on the number of heading.

There are six different HTML headings which are defined with the <h1> to <h6> tags.

h1 is the largest heading tag and h6 is the smallest one. So h1 is used for most important heading and h6 is used
for least important.

See this example:

1. <h1>Heading no. 1</h1>


2. <h2>Heading no. 2</h2>
3. <h3>Heading no. 3</h3>
4. <h4>Heading no. 4</h4>
5. <h5>Heading no. 5</h5>
6. <h6>Heading no. 6</h6>
Test it Now

Output:

Heading no. 1

Heading no. 2
Focus Abhishek you can do it …

Heading no. 3

Heading no. 4

Heading no. 5

Heading no. 6

Heading elements (h1....h6) should be used for headings only. They should not be used just to make text bold or big.

Bigger Headings
Each HTML heading has a default size. However, you can specify the size for any heading with the style attribute:

Example
<h1 style="font-size:60px;">Heading 1</h1>

Try it Yourself »

The HTML <head> Element


The HTML <head> element has nothing to do with HTML headings.

The <head> element is a container for metadata. HTML metadata is data about the HTML document. Metadata is not displayed.

The <head> element is placed between the <html> tag and the <body> tag:

Example
<!DOCTYPE html>
<html>

<head>
<title>My First HTML</title>
<meta charset="UTF-8">
</head>

<body>
.
.
.

Try it Yourself »

Note: Metadata typically define the document title, character set, styles, links, scripts, and other meta information.

How to View HTML Source?


Focus Abhishek you can do it …

Have you ever seen a Web page and wondered "Hey! How did they do that?"

View HTML Source Code:

To find out, right-click in the page and select "View Page Source" (in Chrome) or "View Source" (in IE), or similar in other browsers.
This will open a window containing the HTML source code of the page.

Inspect an HTML Element:

Right-click on an element (or a blank area), and choose "Inspect" or "Inspect Element" to see what elements are made up of (you
will see both the HTML and the CSS). You can also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.

Test Yourself with Exercises!


Exercise 1 » Exercise 2 » Exercise 3 » Exercise 4 »

HTML Tag Reference


W3Schools' tag reference contains additional information about these tags and their attributes.

You will learn more about HTML tags and attributes in the next chapters of this tutorial.

Tag Description

<html> Defines the root of an HTML document

<body> Defines the document's body

<head> A container for all the head elements (title, scripts, styles, meta information, and more)

<h1> to <h6> Defines HTML headings

<hr> Defines a thematic change in the content

HTML Paragraphs
The HTML <p> element defines a paragraph:
Focus Abhishek you can do it …

Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

Try it Yourself »

Note: Browsers automatically add some white space (a margin) before and after a paragraph.

HTML Display
You cannot be sure how HTML will be displayed.

Large or small screens, and resized windows will create different results.

With HTML, you cannot change the output by adding extra spaces or extra lines in your HTML code.

The browser will remove any extra spaces and extra lines when the page is displayed:

Example
<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>

<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>

Try it Yourself »

HTML Styles
Example

I am Red

I am Blue

I am Big
Try it Yourself »
Focus Abhishek you can do it …

The HTML Style Attribute


Setting the style of an HTML element, can be done with the style attribute.

The HTML style attribute has the following syntax:

<tagname style="property:value;">

The property is a CSS property. The value is a CSS value.

You will learn more about CSS later in this tutorial.

HTML Background Color


The background-color property defines the background color for an HTML element.

This example sets the background color for a page to powderblue:

Example
<body style="background-color:powderblue;">

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>

HTML Text Color


The color property defines the text color for an HTML element:

Example
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>

Try it Yourself »

HTML Fonts
The font-family property defines the font to be used for an HTML element:

Example
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p>

Try it Yourself »

HTML Text Size


Focus Abhishek you can do it …

The font-size property defines the text size for an HTML element:

Example
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>

Try it Yourself »

HTML Text Alignment


The text-align property defines the horizontal text alignment for an HTML element:

Example
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>

Try it Yourself »

Chapter Summary
 Use the style attribute for styling HTML elements
 Use background-color for background color
 Use color for text colors
 Use font-family for text fonts
 Use font-size for text sizes
 Use text-align for text alignment

Test Yourself with Exercises!


Exercise 1 » Exercise 2 » Exercise 3 » Exercise 4 » Exercise 5 » Exercise 6 »

HTML Text Formatting

Text Formatting
This text is bold

This text is italic


Focus Abhishek you can do it …

This is subscript and superscript

Try it Yourself »

HTML Formatting Elements


In the previous chapter, you learned about the HTML style attribute.

HTML also defines special elements for defining text with a special meaning.

HTML uses elements like <b> and <i> for formatting output,
like bold or italic text.

Formatting elements were designed to display special types of text:

 <b> - Bold text


 <strong> - Important text
 <i> - Italic text
 <em> - Emphasized text
 <mark> - Marked text
 <small> - Small text
 <del> - Deleted text
 <ins> - Inserted text
 <sub> - Subscript text
 <sup> - Superscript text

HTML <b> and <strong> Elements


The HTML <b> element defines bold text, without any extra importance.

Example
<b>This text is bold</b>

Try it Yourself »

The HTML <strong> element defines strong text, with added semantic
"strong" importance.
Focus Abhishek you can do it …

Example
<strong>This text is strong</strong>

Try it Yourself »

HTML <i> and <em> Elements


The HTML <i> element defines italic text, without any extra importance.

Example
<i>This text is italic</i>

Try it Yourself »

The HTML <em> element defines emphasized text, with added semantic
importance.

Example
<em>This text is emphasized</em>

Try it Yourself »

Note: Browsers display <strong> as <b>, and <em> as <i>. However, there is
a difference in the meaning of these tags: <b> and <i> defines bold and italic
text, but <strong> and <em> means that the text is "important".

HTML <small> Element


The HTML <small> element defines smaller text:
Focus Abhishek you can do it …

Example
<h2>HTML <small>Small</small> Formatting</h2>

Try it Yourself »

HTML <mark> Element


The HTML <mark> element defines marked or highlighted text:

Example
<h2>HTML <mark>Marked</mark> Formatting</h2>

Try it Yourself »

HTML <del> Element


The HTML <del> element defines deleted (removed) text.

Example
<p>My favorite color is <del>blue</del> red.</p>

Try it Yourself »

HTML <ins> Element


The HTML <ins> element defines inserted (added) text.

Example
<p>My favorite <ins>color</ins> is red.</p>
Focus Abhishek you can do it …

Try it Yourself »

HTML <sub> Element


The HTML <sub> element defines subscripted text.

Example
<p>This is <sub>subscripted</sub> text.</p>

Try it Yourself »

HTML <sup> Element


The HTML <sup> element defines superscripted
text.

Example
<p>This is <sup>superscripted</sup> text.</p>

Try it Yourself »

Test Yourself with Exercises!


Exercise 1 » Exercise 2 » Exercise 3 » Exercise 4 » Exercise 5 »

HTML Text Formatting Elements


Focus Abhishek you can do it …

Tag Description

<b> Defines bold text

<em> Defines emphasized text

<i> Defines italic text

<small> Defines smaller text

<strong> Defines important text

<sub> Defines subscripted text

<sup> Defines superscripted text

<ins> Defines inserted text

<del> Defines deleted text

<mark> Defines marked/highlighted text


Focus Abhishek you can do it …

HTML Quotation and Citation Elements

Quotation

Here is a quote from WWF's website:

For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF
works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million
globally.

Try it Yourself »

HTML <q> for Short Quotations


The HTML <q> element defines a short quotation.

Browsers usually insert quotation marks around the <q> element.

Example
<p>WWF's goal is to: <q>Build a future where people live in harmony with nature.</q></p>

Try it Yourself »

HTML <blockquote> for Quotations


The HTML <blockquote> element defines a section that is quoted from another source.

Browsers usually indent <blockquote> elements.

Example
<p>Here is a quote from WWF's website:</p>
<blockquote cite="http://www.worldwildlife.org/who/index.html">
For 50 years, WWF has been protecting the future of nature.
The world's leading conservation organization,
WWF works in 100 countries and is supported by
1.2 million members in the United States and
close to 5 million globally.
</blockquote>

Try it Yourself »

HTML <abbr> for Abbreviations


Focus Abhishek you can do it …

The HTML <abbr> element defines an abbreviation or an acronym.

Marking abbreviations can give useful information to browsers, translation systems and search-engines.

Example
<p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p>

Try it Yourself »

HTML <address> for Contact Information


The HTML <address> element defines contact information (author/owner) of a document or an article.

The <address> element is usually displayed in italic. Most browsers will add a line break before and after the element.

Example
<address>
Written by John Doe.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address>

Try it Yourself »

HTML <cite> for Work Title


The HTML <cite> element defines the title of a work.

Browsers usually display <cite> elements in italic.

Example
<p><cite>The Scream</cite> by Edvard Munch. Painted in 1893.</p>

Try it Yourself »

HTML <bdo> for Bi-Directional Override


The HTML <bdo> element defines bi-directional override.

The <bdo> element is used to override the current text direction:

Example
<bdo dir="rtl">This text will be written from right to left</bdo>
Focus Abhishek you can do it …

Try it Yourself »

Test Yourself with Exercises!


Exercise 1 » Exercise 2 » Exercise 3 » Exercise 4 »

HTML Quotation and Citation Elements

Tag Description

<abbr> Defines an abbreviation or acronym

<address> Defines contact information for the author/owner of a document

<bdo> Defines the text direction

<blockquote> Defines a section that is quoted from another source

<cite> Defines the title of a work

<q> Defines a short inline quotation

HTML Comments

Comment tags are used to insert comments in the HTML source code.

HTML Comment Tags


You can add comments to your HTML source by using the following syntax:

<!-- Write your comments here -->


Focus Abhishek you can do it …

Notice that there is an exclamation point (!) in the opening tag, but not in the closing tag.

Note: Comments are not displayed by the browser, but they can help document your HTML source code.

With comments you can place notifications and reminders in your HTML:

Example
<!-- This is a comment -->

<p>This is a paragraph.</p>

<!-- Remember to add more information here -->

Try it Yourself »

Comments are also great for debugging HTML, because you can comment out HTML lines of code, one at a time, to search for
errors:

Example
<!-- Do not display this at the moment
<img border="0" src="pic_mountain.jpg" alt="Mountain">
-->

Try it Yourself »

HTML Colors

HTML colors are specified using predefined color names, or RGB, HEX, HSL,
RGBA, HSLA values.

Color Names
In HTML, a color can be specified by using a color name:

Tomato
Focus Abhishek you can do it …

Orange

DodgerBlue

MediumSeaGreen

Gray

SlateBlue

Violet

LightGray

Try it Yourself »

HTML supports 140 standard color names.

Background Color
You can set the background color for HTML elements:
Focus Abhishek you can do it …

Hello World

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi
enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis
nisl ut aliquip ex ea commodo consequat.

Example
<h1 style="background-color:DodgerBlue;">Hello World</h1>
<p style="background-color:Tomato;">Lorem ipsum...</p>

Try it Yourself »

Text Color
You can set the color of text:

Hello World
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
lobortis nisl ut aliquip ex ea commodo consequat.

Example
<h1 style="color:Tomato;">Hello World</h1>
<p style="color:DodgerBlue;">Lorem ipsum...</p>
<p style="color:MediumSeaGreen;">Ut wisi enim...</p>

Try it Yourself »
Focus Abhishek you can do it …

Border Color
You can set the color of borders:

Hello World
Hello World
Hello World
Example
<h1 style="border:2px solid Tomato;">Hello World</h1>
<h1 style="border:2px solid DodgerBlue;">Hello World</h1>
<h1 style="border:2px solid Violet;">Hello World</h1>

Try it Yourself »

Color Values
In HTML, colors can also be specified using RGB values, HEX values, HSL
values, RGBA values, and HSLA values:

Same as color name "Tomato":

rgb(255, 99, 71)

#ff6347

hsl(9, 100%, 64%)


Focus Abhishek you can do it …

Same as color name "Tomato", but 50% transparent:

rgba(255, 99, 71, 0.5)

hsla(9, 100%, 64%, 0.5)

Example
<h1 style="background-color:rgb(255, 99, 71);">...</h1>
<h1 style="background-color:#ff6347;">...</h1>
<h1 style="background-color:hsl(9, 100%, 64%);">...</h1>

<h1 style="background-color:rgba(255, 99, 71, 0.5);">...</h1>


<h1 style="background-color:hsla(9, 100%, 64%, 0.5);">...</h1>

Try it Yourself »

RGB Value
In HTML, a color can be specified as an RGB value, using this formula:

rgb(red, green, blue)


Each parameter (red, green, and blue) defines the intensity of the color
between 0 and 255.

For example, rgb(255, 0, 0) is displayed as red, because red is set to its highest
value (255) and the others are set to 0.

To display the color black, all color parameters must be set to 0, like this:
rgb(0, 0, 0).

To display the color white, all color parameters must be set to 255, like this:
rgb(255, 255, 255).
Focus Abhishek you can do it …

Experiment by mixing the RGB values below:

rgb(255, 99, 71)


RED

255

GREEN

99

BLUE

71

Example

rgb(255, 0, 0)

rgb(0, 0, 255)

rgb(60, 179, 113)

rgb(238, 130, 238)

rgb(255, 165, 0)
Focus Abhishek you can do it …

rgb(106, 90, 205)

Try it Yourself »

Shades of gray are often defined using equal values for all the 3 light sources:

Example

rgb(0, 0, 0)

rgb(60, 60, 60)

rgb(120, 120, 120)

rgb(180, 180, 180)

rgb(240, 240, 240)

rgb(255, 255, 255)

Try it Yourself »
Focus Abhishek you can do it …

HEX Value
In HTML, a color can be specified using a hexadecimal value in the form:

#rrggbb
Where rr (red), gg (green) and bb (blue) are hexadecimal values between 00
and ff (same as decimal 0-255).

For example, #ff0000 is displayed as red, because red is set to its highest value
(ff) and the others are set to the lowest value (00).

Example

#ff0000

#0000ff

#3cb371

#ee82ee

#ffa500
Focus Abhishek you can do it …

#6a5acd

Try it Yourself »

Shades of gray are often defined using equal values for all the 3 light sources:

Example

#000000

#3c3c3c

#787878

#b4b4b4

#f0f0f0

#ffffff

Try it Yourself »
Focus Abhishek you can do it …

HSL Value
In HTML, a color can be specified using hue, saturation, and lightness (HSL) in
the form:

hsl(hue, saturation, lightness)


Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and
240 is blue.

Saturation is a percentage value, 0% means a shade of gray, and 100% is the


full color.

Lightness is also a percentage, 0% is black, 50% is neither light or dark, 100%


is white

Example

hsl(0, 100%, 50%)

hsl(240, 100%, 50%)

hsl(147, 50%, 47%)

hsl(300, 76%, 72%)


Focus Abhishek you can do it …

hsl(39, 100%, 50%)

hsl(248, 53%, 58%)

Try it Yourself »

Saturation
Saturation can be described as the intensity of a color.

100% is pure color, no shades of gray

50% is 50% gray, but you can still see the color.

0% is completely gray, you can no longer see the color.

Example

hsl(0, 100%, 50%)

hsl(0, 80%, 50%)

hsl(0, 60%, 50%)


Focus Abhishek you can do it …

hsl(0, 40%, 50%)

hsl(0, 20%, 50%)

hsl(0, 0%, 50%)

Try it Yourself »

Lightness
The lightness of a color can be described as how much light you want to give
the color, where 0% means no light (black), 50% means 50% light (neither
dark nor light) 100% means full lightness (white).

Example

hsl(0, 100%, 0%)

hsl(0, 100%, 25%)

hsl(0, 100%, 50%)


Focus Abhishek you can do it …

hsl(0, 100%, 75%)

hsl(0, 100%, 90%)

hsl(0, 100%, 100%)

Try it Yourself »

Shades of gray are often defined by setting the hue and saturation to 0, and
adjust the lightness from 0% to 100% to get darker/lighter shades:

Example

hsl(0, 0%, 0%)

hsl(0, 0%, 24%)

hsl(0, 0%, 47%)

hsl(0, 0%, 71%)


Focus Abhishek you can do it …

hsl(0, 0%, 94%)

hsl(0, 0%, 100%)

Try it Yourself »

RGBA Value
RGBA color values are an extension of RGB color values with an alpha channel -
which specifies the opacity for a color.

An RGBA color value is specified with:

rgba(red, green, blue, alpha)


The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not
transparent at all):

Example

rgba(255, 99, 71, 0)

rgba(255, 99, 71, 0.2)

rgba(255, 99, 71, 0.4)


Focus Abhishek you can do it …

rgba(255, 99, 71, 0.6)

rgba(255, 99, 71, 0.8)

rgba(255, 99, 71, 1)

Try it Yourself »

HSLA Value
HSLA color values are an extension of HSL color values with an alpha channel -
which specifies the opacity for a color.

An HSLA color value is specified with:

hsla(hue, saturation, lightness, alpha)


The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not
transparent at all):

Example

hsla(9, 100%, 64%, 0)

hsla(9, 100%, 64%, 0.2)


Focus Abhishek you can do it …

hsla(9, 100%, 64%, 0.4)

hsla(9, 100%, 64%, 0.6)

hsla(9, 100%, 64%, 0.8)

hsla(9, 100%, 64%, 1)

Try it Yourself »

You might also like