HTML GreatthoughtsIT
HTML GreatthoughtsIT
-WEB DEVELOPMENT
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?
The HTML element is everything from the start tag to the end tag:
<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:
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>
</body>
</html>
HTML Basics
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
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
Example
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
HTML LISTS
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
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:
Multimedia files have formats and different extensions like: .wav, .mp3,
.mp4, .mpg, .wmv, and .avi.
HTML Video
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:
<input>
<label>
Submit
<select>
<textarea>
<button>
HTML Form Attributes
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:
<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
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
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
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
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>