0% found this document useful (0 votes)
4 views37 pages

HTML GreatthoughtsIT

HTML (Hyper Text Markup Language) is the standard markup language for creating web pages, consisting of elements that define the structure and content of a webpage. Key components include the document type declaration, elements like <html>, <head>, <body>, and various tags for headings, paragraphs, links, images, lists, tables, and multimedia. HTML also supports forms for user input and attributes that provide additional information about elements.
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)
4 views37 pages

HTML GreatthoughtsIT

HTML (Hyper Text Markup Language) is the standard markup language for creating web pages, consisting of elements that define the structure and content of a webpage. Key components include the document type declaration, elements like <html>, <head>, <body>, and various tags for headings, paragraphs, links, images, lists, tables, and multimedia. HTML also supports forms for user input and attributes that provide additional information about elements.
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/ 37

HTML 5

-WEB DEVELOPMENT

K Venkata Sai Rama Raju


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.
A Simple HTML Document

Example Explained
Example
•The <!DOCTYPE html> declaration defines that this document is an HTML5 document
•The <html> </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
<!DOCTYPE html>
<html>
<head> contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
<title>Page Title</title>
</head>
<body>
•The <h1> element defines a large heading
<h1>My First Heading</h1> •The <p> element defines a paragraph
<p>My first paragraph.</p>

</body>
</html>
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:

<p>My first paragraph.</p>

<h1>My First Heading</h1>


Visualization of an HTML page structure:

<html>

<head>

<title>Page Title</title>

</head>

<body>

<h1>This is a heading</h1>

<p>This is a Paragraph</p>

</body>
</html>
Year Version
1989: Tim Berners-Lee invented www
1991: Tim Berners-Lee invented HTML
1993: Dave Raggett drafted HTML+
1995: HTML Working Group defined HTML 2.0
1997: HTML 3.2
1999: HTML 4.01
HTML History 2000: XHTML 1.0
2008: WHATWG HTML5 First Public Draft
2012: WHATWG HTML5 Living Standard
2014: HTML5
2016: HTML 5.1
2017: HTML5.1 2nd Edition
2017: HTML5.2
All HTML documents must start with a document type declaration:

HTML <!DOCTYPE html>.

Documents
The HTML document itself begins with <html> and ends with </html>.

The visible part of the HTML document is between <body> and </body>.

Example
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>
HTML Basics

 The <!DOCTYPE> Declaration  HTML Headings  HTML Paragraphs


 The <!DOCTYPE> declaration
represents the document type and  HTML headings are defined  HTML paragraphs are defined
helps browsers to display web pages with the <h1> to <h6> tags. with the <p> tag:
correctly.
 <h1> defines the most
important heading. <h6>  Example
 It must only appear once, at the top defines the least important
of the page (before any HTML tags). heading:  <p>This is a paragraph.</p>
 <p>This is another
Example paragraph.</p>
 The <!DOCTYPE> declaration is not 
case sensitive.  <h1>This is heading 1</h1>
 <h2>This is heading 2</h2>

 The <!DOCTYPE> declaration for  <h3>This is heading 3</h3>


HTML5 is:
 <!DOCTYPE html>
HTML Basics

 HTML Links  HTML Images


 HTML links are defined with the  HTML images are defined with the <img>
<a> tag: tag.

 Example  The source file (src), alternative text (alt),


width, and height are provided as attributes:
 <a
href="https://www.w3schools.com"
>This is a link</a>
 Example
 <img src="w3schools.jpg"
alt="W3Schools.com" width="104"
height="142">
HTML elements can be nested (this means that elements can contain other elements).
All HTML documents consist of nested HTML elements.

The following example contains four HTML elements (<html>, <body>, <h1> and
Nested HTML
Elements
<p>):

Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<hr/>
<center>
<p>This text is in the center.</p>
</center>
</body>
</html>
HTML Attributes

All HTML elements can have attributes


Attributes provide additional information about elements There are two ways to specify the URL in the src attribute:
Attributes are always specified in the start tag
1. Absolute URL - Links to an external image that is hosted on another
Attributes usually come in name/value pairs like name="value“
website. Example: src="https://www.amazon.com/images/img_girl.jpg".

The href Attribute


2. Relative URL - Links to an image that is hosted within the website. Here,
The <a> tag defines a hyperlink. The href attribute specifies the the URL does not include the domain name. If the URL begins without a
URL of the page the link goes to:
slash, it will be relative to the current page. Example: src="img_girl.jpg". If
Example the URL begins with a slash, it will be relative to the domain. Example:
<a href="https://www.amazon.com">Visit www.amazon</a> src="/images/img_girl.jpg".

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 Attributes

 Width and Height Attributes  The alt Attribute  Style and Title Attribute

 The <img> tag should also  The required alt attribute for  The style attribute is used to add styles to an
contain the width and height the <img> tag specifies an element, such as color, font, size, and more.
attributes, which specify the alternate text for an image, if  Example
width and height of the image the image for some reason
(in pixels): cannot be displayed. This can  <p style="color: red;">This is a red paragraph.</p>
be due to a slow connection,  The title attribute defines some extra information
or an error in the src attribute, about an element.
 Example or if the user uses a screen
reader.  The value of the title attribute will be displayed as a
 <img src="img_girl.jpg" tooltip when you mouse over the element:
width="500" height="600">

 Example
 Example
 <img src="img_girl.jpg"
 <p title="I'm a tooltip">This is a paragraph.</p>
alt="Girl with a jacket">
HTML Text Formatting

HTML contains several elements for defining text Formatting elements were designed to display special types of text:
with a special meaning.
<b> - Bold text <br></b>
Example <strong> - Important text<br></strong>
<i> - Italic text</i><br>
This text is bold <em> - Emphasized text</em><br>
<mark> - Marked text</mark><br>
This text is italic <small> - Smaller text</small><br>
<del> - Deleted text </del> <br>
This is subscript and superscript
<ins> - Inserted text </ins> <br>
<sub> - Subscript text </sub><br>
<sup> - Superscript text</sup><br>
HTML Quotation and Citation Elements

HTML <blockquote> for Quotations HTML <abbr> for Abbreviations


HTML <q> for Short Quotations
The HTML <abbr> tag defines an
The HTML <blockquote> element defines a The HTML <q> tag defines a short
abbreviation or an acronym, like "HTML",
section that is quoted from another source. quotation.
"CSS", "Mr.", "Dr.", "ASAP", "ATM".
Browsers normally insert quotation marks
Marking abbreviations can give useful
<blockquote around the quotation.
information to browsers, translation systems
cite="http://www.worldwildlife.org/who/index.h and search-engines.
tml"> Example
<p>WWF's goal is to: <q>Build a future
For 60 years, WWF has worked to help people <p>The <abbr title="World Health
where people live in harmony with
and nature thrive. As the world's leading Organization">WHO</abbr> was founded in
nature.</q></p>
conservation organization, WWF works in 1948.</p>
nearly 100 countries.
</blockquote>
HTML LISTS

Unordered HTML List


An unordered list starts with the <ul> tag. Btech
Each list item starts with the <li> tag. o CSC
The list items will be marked with bullets  ECE
(small black circles) by default:
 Civil
Example
1. EEE
<ul>
<li> Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
HTML LISTS

Ordered HTML List

• An ordered list starts with the <ol> tag.


Each list item starts with the <li> tag.

• The list items will be marked with numbers


by default:

Example
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
HTML LISTS

HTML Description Lists


HTML also supports description lists.

A description list is a list of terms, with a description of each term.

The <dl> tag defines the description list, the <dt> tag defines the term (name), and the <dd> tag describes
each term:

Example
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
HTML Table

A table in HTML consists of table cells inside rows and columns.


<!DOCTYPE html>
<html><body>
<table border="12" bgcolor="red">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr> <tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr></table></body></html>
HTML Table

Table Cells
Each table cell is defined by a <td> and a
</td> tag.

Table Rows
Each table row starts with a <tr> and ends
with a </tr> tag.

Table Headers
Sometimes you want your cells to be table
header cells. In those cases, use the <th> tag
instead of the <td> tag:

th stands for table header.


HTML Multimedia

Multimedia comes in many different formats. It can be almost anything you


can hear or see, like images, music, sound, videos, records, films,
animations, and more.

Web pages often contain multimedia elements of different types and


formats

Multimedia elements (like audio or video) are stored in media files.


The most common way to discover the type of a file, is to look at the file
extension.

Multimedia files have formats and different extensions like: .wav, .mp3,
.mp4, .mpg, .wmv, and .avi.
HTML Video

The HTML <video> Element How it Works


The controls attribute adds video controls, like play, pause, and volume.
To show a video in HTML, use the <video>
element: It is a good idea to always include width and height attributes. If height
and width are not set, the page might flicker while the video loads.
Example
<video width="320" height="240" controls> The <source> element allows you to specify alternative video files which
<source src="movie.mp4" type="video/mp4"> the browser may choose from. The browser will use the first recognized
<source src="movie.ogg" type="video/ogg"> format.
Your browser does not support the video tag.
</video> The text between the <video> and </video> tags will only be displayed in
browsers that do not support the <video> element
HTML Audio

The HTML <audio> Element


How It Works
To play an audio file in HTML, use the <audio> element:
The controls attribute adds audio controls, like play, pause, and volume.
Example
The <source> element allows you to specify alternative audio files which
<audio controls>
the browser may choose from. The browser will use the first recognized
<source src="horse.ogg" type="audio/ogg">
format.
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
The text between the <audio> and </audio> tags will only be displayed in
</audio>
browsers that do not support the <audio> element.
HTML Forms

An HTML form is used to collect user input. The user input is most often The <form> Element
sent to a server for processing.
The HTML <form> element is used to create
Example an HTML form for user input:

First Name: <form>


.
.
</form>
Last Name: The HTML <form> element can contain one
or more of the following form elements:

<input>
<label>
Submit
<select>
<textarea>
<button>
HTML Form Attributes

The Action Attribute The Target Attribute

The action attribute defines the action to be performed when the form is The target attribute specifies where to display the response that is
submitted. received after submitting the form.

Example The target attribute can have one of the following values:
On submit, send form data to "action_page.php": Value Description
The response is displayed in a new window or tab
_blank
<form action="/action_page.php">
<label for="fname">First name:</label><br> The response is displayed in the current window
_self
<input type="text" id="fname" name="fname" value="John"><br> The response is displayed in the parent frame
_parent
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br> The response is displayed in the full body of the window
_top
<input type="submit" value="Submit">
</form> Example
Here, the submitted result will open in a new browser tab:

<form action="/action_page.php" target="_blank">


More Tags

<input type="button"><br>
<input type="checkbox"><br>
<input type="color"><br>
<input type="date"><br>
<input type="datetime-local"><br>
<input type="email"><br>
<input type="file"><br>
<input type="hidden"><br>
<input type="image"><br>
<input type="month"><br>
<input type="number"><br>
<input type="password"><br>
<input type="radio"><br>
<input type="range"><br>
<input type="reset"><br>
<input type="search"><br>
<input type="submit"><br>
<input type="tel"><br>
<input type="text"> <br>
<input type="time"><br>
<input type="url"><br>
<input type="week"><br>
Example: Creating a basic form

<form action="index2.html"> <label for="">Address line 2:</label>


<label for="">Name:</label> <input type="text"><br>
<input type="text" placeholder="first name" <label for="">City</label>
name="fname"> <input type="text"><br>
<input type="text" placeholder="last name" <label for="">State</label>
name="lname"> <input type="text"><br>
<br> <label for="">Pincode</label>
<label for="">Age</label> <input type="number"><br>
<input type="number" name="age"> <label for="">Country</label>
<br> <select name="Country" id="">
<label for="">Gender</label><br> <option value="Ind">India</option>
<input type="radio" name="gender" id="male"> <option value="Ban">Bangladesh</option>
<label for="">male</label> <option value="SriLanka">Sri Lanka</option>
<input type="radio" name="gender" id="female"> </select>
<label for="">female</label> <br>
<input type="radio" name="gender" id="other"> <input type="checkbox" name="accept">
<label for="">other</label> <label for="">You accept to share this
<br> information</label>
<label for="">Address:</label><br> <br>
<label for="">Address line 1:</label> <button type="submit">Submit</button>
<input type="text"><br> </form>
HTML Block and Inline Elements

Every HTML element has a default display value, depending on what type
of element it is. Here are some block-
There are two display values: block and inline level elements in
HTML:
A block-level element always starts on a new line, and the browsers automatically add some space (a margin) before and <address>
after the element. <article>
<aside>
A block-level element always takes up the full width available (stretches out to the left and right as far as it can). <blockquote>
<canvas>
Two commonly used block elements are: <p> and <div>. <fieldset>
<figcaption>
The <p> element is a block-level element. <figure>
The <div> element is a block-level element. <footer>
<form>
Example

<p>Hello World</p>
<div>Hello World</div>
HTML Block and Inline Elements

Inline Elements
Here are some of inline elements in HTML:
An inline element does not start on a new line. <a>
An inline element only takes up as much width as necessary. <abbr>
<acronym>
This is a <span> element inside a paragraph. <b>
<bdo>
Example <big>
<span>Hello World</span> <br>
<button>
<cite>
<code>
HTML Semantic Elements

What are Semantic Elements?


A semantic element clearly describes its meaning to both the browser and
the developer.

Examples of non-semantic elements: <div> and <span> - Tells nothing


about its content.

Examples of semantic elements: <form>, <table>, and <article> - Clearly


defines its content.

In HTML there are some semantic elements that can be used to define
different parts of a web page:
<figure>
<article> <nav>
<footer>
<aside> <section>
<header>
<details> <summary>
<main>
<figcaption> <time>
<mark>
More examples

https://www.tutorialspoint.com/html/html_tags_ref.htm
Html - 5

Navigation
Audio/Video

<!DOCTYPE html> <!DOCTYPE html>


<html> <html>
<body> <body>
<h1>Example of HTML nav Tag</h1> <video width = "300" height = "200" controls autoplay>
<h2>Online Programming Courses</h2> <source src = "./dog.mp4" type ="video/mp4" />
<nav> </video>
<a href="#">HTML</a> |
<a href="#">CSS</a> | <!-- Code to setup audio -->
<a href="#">JavaScript</a> |
<a href="#">Python</a> <audio controls>
</nav> <source src="dog.mp3" type="audio/mp3">
</body> </audio>
</html>
</body>
</html>
Html - 5

Header
Footer

<!DOCTYPE html>
<html> <!DOCTYPE html>
<body> <html>
<h1>Online Coaching </h1> <body>
<h3> Find courses that are the best for your career </h3> <footer>
<header> <p>Posted by: Deepali Sharma</p>
<a href=https://www.w3schools.com>Technology</a> | <p>Contact information: <a
<a href=https://www.google.com>Google</a> | href="mailto:[email protected]">
<a href=https://www.facebook.com>FaceBook</a> | [email protected]</a>.</p>
</header> </footer>
</body> </body>
</html> </html>
Html - 5

Figrue & Figcaption


Mark
<!DOCTYPE html>
<html>
<body> <!DOCTYPE html>
<figure> <html>
<img src="red tulips.jpg" <body>
alt="Red Tulips"> <p> Grow your skillset with <mark>Shiksha Online.</mark>
<figcaption>Red Tulips in a Garden</figcaption> Find the <mark>best online courses</mark> and certifications in
</figure> management, technology, programming, and data science.</p>
</body> </body>
</html> </html>
Html - 5

Main
Progress
<!DOCTYPE html>
<html>
<body> <!DOCTYPE html>
<header> <html>
<p>Header content</p> <body>
</header> <span>Loading:</span>
<main> <progress value="55" max="100"></progress>
<p>Main Content</p> </body>
<h2>Shiksha Online</h2> </html>
<p> Find courses that are best for your career </p>
</main>
</body>
</html>
Html - 5

Section

<!DOCTYPE html>
<html>
<body>
<section>
<h1>Section 1</h1>

<p>Section 1 content</p>

</section>
<section>
<h1>Section 2</h1>

<p>Section 2 content</p>

</section>
</body>
</html>
Html - 5

Frames
<!DOCTYPE html>
<!DOCTYPE html> <html>
<html>
<frameset cols=20%,80%> <frameset cols="*,*,*,*"> <frame
<frame src="AudioVideo.html" name="leftside"> src="../file_path/frame_1.html">
<frame src="Airbooking.html" name="rightside"> <frame src="frame_2.html">
</frameset>
</html> <frame src="frame_3.html">
<frame src="frame_4.html">
</frameset>
</html>

You might also like