Welcome to a personal project created during a summer holidays filled with curiosity and the desire to learn something new.
As someone who started learning HTML from scratch, I understand the excitement and challenges that come with it. Here, you'll find straightforward guides and practical examples that make learning HTML enjoyable and accessible.
So, take a moment to relax, maybe grab a cup of coffee, and enjoy the process of creating something awesome with HTML.
* It's HTML-only page, NO fancy graphics. *
🧋💻 Let's explore...
Contents
Introduction to HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets and scripting languages such as JavaScript.
<h1 > My First Heading</h1 > <p > My first paragraph.</p >
</body > </html >
OUTPUT :
My First Heading
My first paragraph.
Components of HTML Document
<!DOCTYPEhtml >
Defines that this document is an HTML5 document.All HTML documents must start with a document type declaration.
<html > ...</html >
This element is the root element of an HTML page.
<head > ...</head >
This element contains meta information about the HTML page. like Title, Viewport, Charset, Style, etc.
<title > ...<title >
This element specifies a title for the HTML page (which is shown in the browser's title bar or in the page's tab)
<body > ...<body >
This element defines the document's body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
<h1 > ...<h1 >
This element defines the large Heading.
<p > ...<p >
This element defines the Paragraph or text content.
What is an HTML Element ?
An HTML element is defined by a start tag, some content, and an end tag:
<tagname > ...</tagname >
The HTML element is everything from the start tag to the end tag.
Note:
Some HTML elements have no content (like the<br >element). These elements are called empty elements. Empty elements do not have an end tag
HTML | Tags
Style and Semantics tags -
<style > ... </style >
Defines the Style (information CSS) information of the documents. it is included in "head" tag
It is an inline container used to mark up a text or a part of document.
Example : <span > MayBorg
</span >
<header > ... </header >
Represents a container for introductory content or a set of navigational links.the hgroup tag is used inside header to group headings and "p" elements to style later using CSS. It typically contains :
Specifies main content in a document, the content inside the "main" element should be unique to document . It should not contain any contain any repeated content aacross document such as SideBars, Navigation Links, Copyright Info, Site Logo, and Search Forms.
Note:
There must only be one "main" element in a document. the "main" element must not be the decendent of:
<article>
<aside>
<header>
<footer>
<nav>
etc.
<section > ... </section >
Defines a Section in a document. that can de navigated via links in the navbars.
<search > ... </search>
Defines a search section Elements inside search can be form elements used to perform search.
Defines a search section Elements inside search can be form elements used to perform search.
Example : <article >
<h3 > Tokyo -Japan </h3 > <p > Tokyo , officially the Tokyo Metropolis (東京都, Tōkyō-to), is the capital of Japan and one of the most populous cities in the world, with a population of over 14 million residents as of 2023 and the second-most-populated capital in the world. </p>
</article >
OUTPUT :
Tokyo -Japan
Tokyo , officially the Tokyo Metropolis (東京都, Tōkyō-to), is the capital of Japan and one of the most populous cities in the world, with a population of over 14 million residents as of 2023 and the second-most-populated capital in the world.
<aside > ... </aside>
tag defines some content aside from the content it is placed in.
The aside content should be indirectly related to the surrounding content. Tip : The "aside" content is often placed as a sidebar in a document.
Note:
The "aside" element does not render as anything special in a browser. However, you can use CSS to style the "aside" element (see example below).
Example : <aside >
<h3 > Osaka -Japan </h3 > <p > Osaka is a designated city in the Kansai region of Honshu in Japan, and one of the three major cities of Japan (Tokyo-Osaka-Nagoya). It is the capital of and most populous city in Osaka Prefecture, and the third-most populous city in Japan, following the special wards of Tokyo and Yokohama. </p>
</aside >
OUTPUT :
<details > <summary > ... </summary> </details>
The "details" tag specifies additional details that the user can open and close on demand.
The "details" tag is often used to create an interactive widget that the user can open and close. By default, the widget is closed. When open, it expands, and displays the content within.
The "summary" tag is used in conjunction with "details" to specify a visible heading for the details.
Example : <details >
<summary > Nashik -India </summary > <p > Nashik , Marathi: [naːʃik], formerly Nasik is a city in the northern region of the Indian state of Maharashtra. Situated on the banks of the river Godavari. The population of Nashik city is around 2.2 million and is emerging as one of the fastest-growing cities in India. </p>
</details >
OUTPUT : Nashik -India
Nashik , Marathi: [naːʃik], formerly Nasik is a city in the northern region of the Indian state of Maharashtra. Situated on the banks of the river Godavari. The population of Nashik city is around 2.2 million and is emerging as one of the fastest-growing cities in India.
<dialog > ...</dialog>
The "dialog" tag defines a dialog box or subwindow.
The "dialog" element makes it easy to create popup dialogs and modals on a web page.
Example : <dialog open >
Hello, Buddy!
</dialog >
OUTPUT :
Link Tags -
<a href="..."> ...</a >
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.
Example : <a href="https://github.com/ Mayborg121" >
Visit My Github </a >
The <link> tag defines the relationship between the current document and an external resource.
The <link> tag is most often used to link to external style sheets or to add a favicon to your website.
The <link> element is an empty element, it contains attributes only.
Example : <link rel="stylesheet" href="styles.css">
OUTPUT :
<nav > ...</nav >
The <nav > tag defines a set of navigation links.
Notice that NOT all links of a document should be inside a<nav > element. The <nav > element is intended only for major blocks of navigation links.
Browsers, such as screen readers for disabled users, can use this element to determine whether to omit the initial rendering of this content.
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.
Note:
Tip:
The "img" tag has two required attributes:
src - Specifies the path to the image
alt - Specifies an alternate text for the image, if the image for some reason cannot be displayed
Note:
Also, always specify the width and height of an image. If width and height are not specified, the page might flicker while the image loads. Tip: To link image to another document, simply nest the<img > tag inside an<a >tag.
Example : <img src="img/aesthetics.jpg" alt="Cartoon picture of a boy and his dog." width="420" height="325">
OUTPUT :
<map name="..">...</map >
The "map" tag is used to define an image map. An image map is an image with clickable areas.
Note:
The required name attribute of the "map" element is associated with the <img > 's usemap attribute and creates a relationship between the image and the map.
The <map > element contains a number of <area > elements, that defines the clickable areas in the image map.
<area shape="..." coords="..." href="...">
The "area" tag defines an area inside an image map (an image map is an image with clickable areas)."area" elements are always nested inside a "map" tag.
Example : <h4>
Click on the objects in image : </h4>
The "canvas" tag is used to draw graphics, on the fly, via scripting (usually JavaScript).
The "canvas" tag is transparent, and is only a container for graphics, you must use a script to actually draw the graphics.
Note:
you must use a script to actually draw the graphics.
The "figure" tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.
While the content of the "figure" element is related to the main flow, its position is independent of the main flow, and if removed it should not affect the flow of the document.
<figcaption > ...</figcaption >
The "figcaption" tag defines a caption for a "figure" element.
The "figcaption" element can be placed as the first or last child of the "figure" element.
The "picture" tag gives web developers more flexibility in specifying image resources.
The most common use of the "picture" element will be for art direction in responsive designs. Instead of having one image that is scaled up or down based on the viewport width, multiple images can be designed to more nicely fill the browser viewport.
The browser will look for the first<source > element where the media query matches the current viewport width, and then it will display the proper image (specified in the srcset attribute). The<img > element is required as the last child of the<picture >element, as a fallback option if none of the source tags matches.
<source media=".." srcset=".." >
The <source > tag is used to specify multiple media resources for media elements, such as<video>,<audio >, and
Example : <p>
Resize the browser window to load different images. </p>
The <audio > tag is used to embed sound content in a document, such as music or other audio streams.
The <audio > tag contains one or more <source > tags with different audio sources. The browser will choose the first source it supports.
The text between the <audio > and </audio > tags will only be displayed in browsers that do not support the <audio > element.
There are three supported audio formats in HTML: MP3, WAV, and OGG.
Example : <audio controls >
<source src="\img\roja.mp3" type="audio/mpeg"> </audio >
OUTPUT :
<video controls >...</video >
The <audio > tag is used to embed sound content in a document, such as music or other audio streams.
The <audio > tag contains one or more <source > tags with different audio sources. The browser will choose the first source it supports.
The text between the <audio > and </audio > tags will only be displayed in browsers that do not support the <audio > element.
There are three supported audio formats in HTML: MP3, WAV, and OGG.
Defines an abbrevation or an Acronym for a phrase. here only abbrevation is displayed and the abbrivated text is displayed when hovered over(similiar to tooltips).
Example : <abbr title = "Mayur Borgude" >
MayBorg
</abbr >
OUTPUT :
MayBorg
<address > ...</address >
The "address" tag in HTML indicates the contact information of a person or an organization. The contact information can be an email address, URL, physical address, mobile number, social media, etc.
Example : <address >
Written By : <a href="mailto:
mayurborgude@gmail.com">
Mayur Borgude</a>
Visit Us At :
Github.com/Mayborg121
P/O - 422003 , HAL Airbase
Nashik,Ind.
</address >
OUTPUT :
Written By :
Mayur Borgude
Visit Us At :
Github.com/Mayborg121
P/O - 422003 , HAL Airbase
Nashik,Ind.
<b > ...</b >
The "b" (Bold) tag in HTML is for making text bold without adding extra importance. Text within "b" displays in a bold style.
Example : <b >
This Text Will Be Bold.
</b >
OUTPUT :
This Text Will Be Bold.
<i > ...</i >
The "i" (italic) tag in HTML is used to display the content in italic style. This tag is generally used to display the technical term, phrase, the important word in a different language.
Example : <i >
This Text Will Be Bold.
</i >
OUTPUT :
This Text Will Be Italic.
<blockquote > ...</blockquote >
The "blockquote" tag specifies a section that is quoted from another source.
Example : <blockquote cite="https://
www.vincentvangogh.org/ quotes.jsp" >
" Only when I fall do I get up again. " - Vincent Van Gogh
</blockquote >
OUTPUT :
" Only when I fall do I get up again. " - Vincent Van Gogh
<cite > ...</cite >
The "cite" tag defines the title of a creative work (e.g. a book, a poem, a song, a movie, a painting, a sculpture, etc.).
Note:
The text in the <cite > element usually renders in italic.
Example : <h3 >Citing Van Gogh's Art</h3 >
<img src="/img/ Sunflowers_vangogh.jpg" width="200" height="200" alt="The Sunflowers"> <p >
<cite>The Sunflowers</cite > by Vincent Van Gogh. </p>
OUTPUT :
Citing Van Gogh's Art
The Sunflowers by Vincent Van Gogh,1888.
<code > ...</code >
The "code" tag is used to define a piece of computer code. The content inside is displayed in the browser's default monospace font.
Example : <code > This is code </code >
OUTPUT : This is code
<del > ...</del > <ins > ...</ins >
The "del" tag defines text that has been deleted from a document. Browsers will usually strike a line through deleted text. "ins" is used to unsert the new text its usually used after "del" tag.
Example : <p > I love <del > Cats </del> <ins > Dogs</ins > ! </p >
OUTPUT :
I love Cats Dogs!
<dfn > ...</dfn >
The "dfn" tag stands for the "definition element", and it specifies a term that is going to be defined within the content. It is shown as tooltip.The nearest parent of the "dfn" tag must also contain the definition/explanation for the term.
Example : <p > <dfn title="HyperText Markup
Language">HTML
</dfn>
is the standard markup language for creating web pages.
</p>
OUTPUT :
HTML
is the standard markup language
for creating web pages.
<mark > ...</mark >
The "mark" tag is used to highlight or mark the text.
Example : <p > <mark >
HTML
</mark >
is the standard markup language for creating web pages.
</p>
OUTPUT :
HTML
is the standard markup language
for creating web pages.
<meter > ...</meter >
The "meter" tag defines a scalar measurement within a known range, or a fractional value. This is also known as a gauge.
Examples: Disk usage, the relevance of a query result, etc.
Note:
The "meter" tag should not be used to indicate progress (as in a progress bar). For progress bars, use the <progress > tag.
Tip: Always add the "label" tag for best accessibility practices!
Example : <label for="disk_c"> Disk usage C: </label > <meter id="disk_c" value="6"
min="0" max="10">
6 out of 10 </meter >
OUTPUT : 2 out of 10
<progress > ...</progress >
The "progress" tag represents the completion progress of a task.
Tip:
Examples: Disk usage, the relevance of a query result, etc.
Note:
Always add the<label > tag for best accessibility practices ! Tip: Use the<progress >tag in conjunction with JavaScript to display the progress of a task.
Example : <label for="file"> Download Progress : </label > <progress id="file" value="73"
min="0" max="100">
73% out of 100% </progress >
OUTPUT :
<s > ...</s >
The "s"(strike-through) tag specifies text that is no longer correct, accurate or relevant. The text will be displayed with a line through it.
Example : <s >
this text is Striked-through.
</s >
OUTPUT :
this text is Striked-through.
<sub > ...</sub >
The "sub" (subscript) tag defines subscript text. Subscript text appears half a character below the normal line, and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O.
The "sup" (superscript) tag defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font. its used in mathematical equations for exponentials .
Example : <p >
Two Squared = 2<sup >
2</sup > = 4
</p >
OUTPUT :
Two Squared = 2 2
= 4
<template > ...</template >
The "template" tag is used as a container to hold some HTML content hidden from the user when the page loads.
The content inside "template" can be rendered later with a JavaScript.
You can use the "template" tag if you have some HTML code you want to use over and over again, but not until you ask for it. To do this without the "template" tag, you have to create the HTML code with JavaScript to prevent the browser from rendering the code.
Example : <button onclick="showContent()">
Trigger Template </button>
<script >
function showContent() {
let temp =
document.getElementsByTagName
("template")[0];
let clon =
temp.content.cloneNode(true);
document.body.appendChild(clon);} </script >
OUTPUT :
Mountains : Pixel Art
List Tags -
<menu> ...</menu >
<li > ...</li >
The<menu > tag defines an unordered list of content.
Use the<menu > tag together with the <li > tag to create menu items.
Note:<menu > tag is an alternative to the<ul > tag and browsers will treat these two lists equally.
The <table > tag defines an HTML table.
An HTML table consists of one<table > element and one or more<tr >,<th >, and<td > elements.
The<tr > element defines a table row, the<th > element defines a table header, and the<td > element defines a table cell.
The<thead > tag is used to group header content in an HTML table.
The<thead > element is used in conjunction with the<tbody > and<tfoot > elements to specify each part of a table (header, body, footer).
Browsers can use these elements to enable scrolling of the table body independently of the header and footer. Also, when printing a large table that spans multiple pages, these elements can enable the table header and footer to be printed at the top and bottom of each page.
The<col > tag specifies column properties for each column within a<colgroup > element.
The<col > tag is useful for applying styles to entire columns, instead of repeating the styles for each cell, for each row.
The <form > tag is used to create an HTML form for user input.
The <form > element can contain one or more of the following form elements:
<input > <textarea > <button > <select > <option > <optgroup > <fieldset > <label > <output >
The<input > tag specifies an input field where the user can enter data.
The<input > element is the most important form element.
The<input > element can be displayed in several ways, depending on the type attribute.
Note:
Always add the<label > tag for best accessibility practices ! Tip:ALways use<label >tag for text,checkbox,radio,file and password input types.
The different input types are as follows:
<input type="button" >
Example :
<input type="button" value="Click Here" onclick="alert('✨Heyy , Have a Good Day✨😊')">
OUTPUT :
<input type="checkbox" >
Example :
<label for="chkbx" >
Are you a Student ? </label > <input type="checkbox" id="chkbx" >
OUTPUT :
<input type="color" >
Example :
<label for="clr" >
Whats your Eye Color ? </label > <input type="color" id="clr" >
OUTPUT :
<input type="xyz" >
Example :
<input type="date">Your Birth Date ? <input type="email" placeholder="Enter Your Mail">
The<iframe > tag specifies an inline frame.
An inline frame is used to embed another document within the current HTML document.
Example :
<iframe src="http://www.fluffbucket.co.uk/basicweb.htm" frameborder="0">
OUTPUT :
<select > ...</select >
<option value="" >...</option >
The <select > element is used to create a drop-down list.
The <select > element is most often used in a form, to collect user input.
The "name" attribute is needed to reference the form data after the form is submitted (if you omit the "name" attribute, no data from the drop-down list will be submitted).
Example :
<label for="cars" >Choose a car: </label>
The <select > element is used to create a drop-down list.
The <select > element is most often used in a form, to collect user input.
The "name" attribute is needed to reference the form data after the form is submitted (if you omit the "name" attribute, no data from the drop-down list will be submitted).
Example :
<label for="review" > Write your feedback below :</label >
The <datalist > tag specifies a list of pre-defined options for an <input > element.
The <datalist > tag is used to provide an "autocomplete" feature for <input > elements. Users will see a drop-down list of pre-defined options as they input data.
The <datalist > element's id attribute must be equal to the <input > element's list attribute (this binds them together).
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.
The following elements can go inside the<head > element:
<title > (required)
<style >
<base >
<link >
<meta >
<script >
<noscript >
Example :
<head > <title > HTML | Examples</title > <meta charset="UTF-8" > <meta name="Keywords" content="HTML,Web,CSS"> </head >
OUTPUT :
*** Its Implemented in this page ***
<base href=".." target=".." >
The <base > tag specifies the base URL and/or target for all relative URLs in a document.
The <base > tag must have either an href or a target attribute present, or both.
There can only be one single <base > element in a document, and it must be inside the <head > element.
The <script > tag is used to embed a client-side script (JavaScript).
The <script > element either contains scripting statements, or it points to an external script file through the src attribute.
Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.
The <embed > tag in HTML is used for embedding external applications which are generally multimedia content like audio or video into an HTML document. It is used as a container for embedding plug-ins such as Flash animations. This tag is a new tag in HTML 5, and it requires only a starting tag.
The <embed > tag in HTML is used for embedding external applications which are generally multimedia content like audio or video into an HTML document. It is used as a container for embedding plug-ins such as Flash animations. This tag is a new tag in HTML 5, and it requires only a starting tag.
HTML attributes provide additional information about HTML elements. They are always included in the opening tag of an element and usually come in name/value pairs like name="value".
id="abc"
The id attribute is a unique identifier that is used to specify the document. It is used by CSS and JavaScript to perform a certain task for a unique element. In CSS, the id attribute is written using the # symbol followed by id.
class=" notes "
The class attribute is used to specify one or more class names for an HTML element. The class attribute can be used on any HTML element. The class name can be used by CSS and JavaScript to perform certain tasks for elements with the specified class name. The class name in CSS stylesheet using “.” symbol.
href =" https://abc.xyz "
The <a > tag defines a hyperlink. The href attribute specifies the URL of the page the link goes to.
src =" \img\pic.jpg "
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.
width="300" height="300"
The img > tag should also contain the width and height attributes, which specify the width and height of the image (in pixels).
alt="Boy on roof tops."
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.
style=" color: #c2f7d6; "
The style attribute is used to add styles to an element, such as color, font, size, and more.its an inline CSS integration.
lang=" en "
You should always include the lang attribute inside the <html > tag, to declare the language of the Web page. This is meant to assist search engines and browsers.
title=" HTML attributes "
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.
<br > & <hr >
These are not attributes but rather formatting tags<br > is used to give a line break which adds a new line character. and<hr > is used to add horizontal rule/line.
What is Favicon ?
A favicon is a small image displayed next to the page title in the browser tab.A favicon, also known as a shortcut icon, website icon, tab icon, URL icon, or bookmark icon, is a file containing one or more small icons associated with a particular website or web page.
Example :
<link rel="icon" type="image/x-icon" href="/img/html.ico" >
OUTPUT :
*** look at the Tab title ***
Responsive HTML | Viewport
The viewport varies with the device, and will be smaller on a mobile phone than on a computer screen.
HTML5 introduced a method to let web designers take control over the viewport, through the <meta > tag. You should include the following <meta > viewport element in all your web pages
The viewport is the user's visible area of a web page.
Example :
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
What is XHTML ?
XHTML or EXtensible HyperText Markup Language is a mix of HTML and XML, very similar to HTML but stricter. It’s like a rulebook for creating web pages that browsers easily understand. Unlike HTML, you have to be careful and follow the rules exactly. Most browsers support it. Just think of it as a more precise way to write web code.
Why XHTML ?
XML is a markup language where all documents must be marked up correctly (be "well-formed").
XHTML was developed to make HTML more extensible and flexible to work with other data formats (such as XML). In addition, browsers ignore errors in HTML pages, and try to display the website even if it has some errors in the markup. So XHTML comes with a much stricter error handling.