HTML Web Technology
HTML Web Technology
HTML (HyperText Markup Language) is the most basic building block of the Web. It defines the
meaning and structure of web content. Other technologies besides HTML are generally used to describe
a web page's appearance/presentation (CSS) or functionality/behavior (JavaScript).
"Hypertext" refers to links that connect web pages to one another, either within a single website or
between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and
linking it to pages created by other people, you become an active participant in the World Wide Web.
HTML uses "markup" to annotate text, images, and other content for display in a Web browser. HTML
markup includes special "elements" such as
<head>, <title>, <body>, <header>, <footer>, <article>, <section>, <p>, <div>, <span>, <img>,
<aside>, <audio>, <canvas>, <datalist>, <details>, <embed>, <nav>, <output>, <progress>, <vi
deo>, <ul>, <ol>, <li> and many others.
HTML was invented by Tim Berners-Lee, a physicist at the CERN research institute in
Switzerland. He came up with the idea of an Internet-based hypertext system. Hypertext means a
text that contains references (links) to other texts that viewers can access immediately. He
published the first version of HTML in 1991, consisting of 18 HTML tags. Since then, each new
version of the HTML language came with new tags and attributes (tag modifiers) to the markup.
According to Mozilla Developer Network’s HTML Element Reference, currently, there are 140
HTML tags, although some of them are already obsolete (not supported by modern browsers). Due
to a quick rise in popularity, HTML is now considered an official web standard. The HTML
specifications are maintained and developed by the World Wide Web Consortium (W3C). You
can check out the latest state of the language anytime on W3C’s website. The biggest upgrade of
the language was the introduction of HTML5 in 2014. It added several new semantic tags to the
markup, that reveal the meaning of their own content, such as <article>, <header>, and <footer>.
Since the first days, HTML has gone through an incredible evolution. W3C constantly publish
new versions and updates, while historical milestones get dedicated names as well. HTML4 (these
days commonly referred to as “HTML”) was published in 1999, while the latest major version
came out in 2014. Named HTML5, the update has introduced many new features to the language.
One of the most anticipated features of HTML5 is native support for audio and video embedding.
Instead of using Flash player, we can simply embed videos and audio files to our web pages using
the new <audio></audio> and <video></video> tags. It also includes in-built support for scalable
vector graphics (SVG) and MathML for mathematical and scientific formulas. HTML5 introduced
a few semantic improvements as well. The new semantic tags inform br owsers about the meaning
of content, which benefits both readers and search engines.
The most popular semantic tags are:
Like most things, HTML comes with a handful of strengths and limitations.
Pros:
• A widely used language with a lot of resources and a huge community behind.
• Runs natively in every web browser.
• Comes with a flat learning curve.
• Open-source and completely free.
• Clean and consistent markup.
• The official web standards are maintained by the World Wide Web Consortium (W3C).
• Easily integrable with backend languages such as PHP and Node.js.
Cons:
• Mostly used for static web pages. For dynamic functionality, you may need to use
JavaScript or a backend language such as PHP.
• It does not allow the user to implement logic. As a result, all web pages need to be created
separately, even if they use the same elements, e.g. headers and footers.
• Some browsers adopt new features slowly.
• Browser behavior is sometimes hard to predict (e.g. older browsers don’t always render
newer tags).
While HTML is a powerful language, it isn’t enough to build a professional and fully responsive
website. We can only use it to add text elements and create the structure of the content. However,
HTML works extremely well with two other frontend languages: CSS (Cascading Style Sheets),
and JavaScript. Together, they can achieve rich user experience and implement advanced
functions.
• CSS is responsible for stylings such as background, colors, layouts, spacing, and
animations.
• JavaScript lets you add dynamic functionality such as sliders, pop-ups, and photo galleries.
6. SO…WHAT IS HTML?
HTML is the main markup language of the web. It runs natively in every browser and is maintained
by the World Wide Web Consortium. You can use it to create the content structure of websites
and web applications. It’s the lowest level of frontend technologies, that serves as the basis for
styling you can add with CSS and functionality you can implement using JavaScript.
HTML documents are files that end with a .html or .htm extension. You can view then using any
web browser (such as Google Chrome, Safari, or Mozilla Firefox). The browser reads the HTML
file and renders its content so that internet users can view it. Usually, the average website includes
several different HTML pages. For instance: home pages, about pages, contact pages would all
have separate HTML documents. Each HTML page consists of a set of tags (also
called elements), which you can refer to as the building blocks of web pages. They create a
hierarchy that structures the content into sections, paragraphs, headings, and other content bl ocks.
Most HTML elements have an opening and a closing that use the <tag></tag> syntax.
Below, you can see a code example of how HTML elements can be structured:
<div>
<h1>The Main Heading</h1>
<h2>A catchy subheading</h2>
<p>Paragraph one</p>
<img src="/" alt="Image">
<p>Paragraph two with a <a href="https://example.com">hyperlink</a></p>
</div>
• The outmost element is a simple division (<div></div>) you can use to mark up bigger
content sections.
• It contains a heading (<h1></h1>), a subheading (<h2></h2>), two paragraphs
(<p></p>), and an image (<img>).
• The second paragraph includes a link (<a></a>) with a href attribute that contains the
destination URL.
• The image tag also has two attributes: src for the image path and alt for the image
description.
8. HTML BASICS
HTML (Hypertext Markup Language) is the code that is used to structure a web page and its content.
For example, content could be structured within a set of paragraphs, a list of bulleted points, or using
images and data tables.
HTML is a markup language that defines the structure of your content. HTML consists of a series
of elements, which you use to enclose, or wrap, different parts of the content to make it appear a certain
way, or act a certain way. The enclosing tags can make a word or image hyperlink to somewhere else,
can italicize words, can make the font bigger or smaller, and so on. For example, take the following line
of content:
If we wanted the line to stand by itself, we could specify that it is a paragraph by enclosing it in paragraph
tags:
HTML tags have two main types: block-level and inline tags.
1. Block-level elements take up the full available space and always start a new line in the
document. Headings and paragraphs are a great example of block tags.
2. Inline elements only take up as much space as they need and don’t start a new line on the
page. They usually serve to format the inner contents of block-level elements. Links and
emphasized strings are good examples of inline tags.
The three block level tags every HTML document needs to contain are <html>, <head>,
and <body>.
1. The <html></html> tag is the highest level element that encloses every HTML page.
2. The <head></head> tag holds meta information such as the page’s title and charset.
3. Finally, the <body></body> tag encloses all the content that appears on the page.
<html>
<head>
<!-- META INFORMATION -->
</head>
<body>
<!-- PAGE CONTENT -->
</body>
</html>
• Headings have 6 levels in HTML. They range from <h1></h1> to <h6></h6>, where h1
is the highest-level heading and h6 is the lowest one. Paragraphs are enclosed by <p></p>,
while blockquotes use the <blockquote> </blockquote> tag.
• Divisions are bigger content sections that typically contain several paragraphs, images,
sometimes blockquotes, and other smaller elements. We can mark them up using
the <div></div> tag. A div element can contain another div tag inside it as well.
• You may also use <ol></ol> tags for ordered lists and <ul></ul> for unordered ones.
Individual list items must be enclosed by the <li></li> tag. For example, this is how a
basic unordered list looks like in HTML:
<ul>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ul>
Many inline tags are used to format text. For example, a <strong></strong> tag would render an
element in bold, whereas <em></em> tags would show it in italics.
Hyperlinks are also inline elements that require <a></a> tags and href attributes to indicate the
link’s destination:
<a href="https://example.com/">Click me!</a>
Images are inline elements too. You can add one using <img> without any closing tag. But you
will also need to use the src attribute to specify the image path, for example:
<img src="/images/example.jpg" alt="Example image">
Some elements have no content and are called empty elements. Take the <img> element that we already
have in our HTML page:
1. The opening tag: This consists of the name of the element (in this case, p), wrapped in opening
and closing angle brackets. This states where the element begins or starts to take effect — in
this case where the paragraph begins.
2. The closing tag: This is the same as the opening tag, except that it includes a forward
slash before the element name. This states where the element ends — in this case where the
paragraph ends. Failing to add a closing tag is one of the standard beginner errors and can lead
to strange results.
3. The content: This is the content of the element, which in this case, is just text.
4. The element: The opening tag, the closing tag, and the content together comprise the element.
Elements can also have attributes that look like the following:
Attributes contain extra information about the element that you don't want to appear in the actual content.
Here, class is the attribute name and editor-note is the attribute value. The class attribute allows you to
give the element a non-unique identifier that can be used to target it (and any other elements with the
same class value) with style information and other things.
Note: Simple attribute values that don't contain ASCII whitespace (or any of the characters " ' ` = < > )
can remain unquoted, but it is recommended that you quote all attribute values, as it makes the code more
consistent and understandable.
You can put elements inside other elements too — this is called nesting. If we wanted to state that our
cat is very grumpy, we could wrap the word "very" in a <strong> element, which means that the word is
to be strongly emphasized:
You do however need to make sure that your elements are properly nested. In the example above, we
opened the <p> element first, then the <strong> element; therefore, we have to close
the <strong> element first, then the <p> element. The following is incorrect:
The elements have to open and close correctly so that they are clearly inside or outside one another. If
they overlap as shown above, then your web browser will try to make the best guess at what you were
trying to say, which can lead to unexpected results. So don't do it!
This contains two attributes, but there is no closing </img> tag and no inner content. This is because an
image element doesn't wrap content to affect it. Its purpose is to embed an image in the HTML page in
the place it appears.
That wraps up the basics of individual HTML elements, but they aren't handy on their own. Now we'll
look at how individual elements are combined to form an entire HTML page. Let's revisit the code we
put into our index.html example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My test page</title>
</head>
<body>
<img src="images/firefox-icon.png" alt="My test image">
</body>
</html>
Here, we have the following:
a) <!DOCTYPE html> — doctype. It is a required preamble. In the mists of time, when HTML
was young (around 1991/92), doctypes were meant to act as links to a set of rules that the
HTML page had to follow to be considered good HTML, which could mean automatic error
checking and other useful things. However these days, they don't do much and are basically
just needed to make sure your document behaves correctly. That's all you need to know for
now.
b) <html></html> — the <html> element. This element wraps all the content on the entire
page and is sometimes known as the root element.
c) <head></head> — the <head> element. This element acts as a container for all the stuff
you want to include on the HTML page that isn't the content you are showing to your page's
viewers. This includes things like keywords and a page description that you want to appear
in search results, CSS to style our content, character set declarations, and more.
d) <meta charset="utf-8"> — This element sets the character set your document should use to
UTF-8 which includes most characters from the vast majority of written languages.
Essentially, it can now handle any textual content you might put on it. There is no reason
not to set this and it can help avoid some problems later on.
e) <title></title> — the <title> element. This sets the title of your page, which is the title that
appears in the browser tab the page is loaded in. It is also used to describe the page when
you bookmark/favorite it.
f) <body></body> — the <body> element. This contains all the content that you want to show
to web users when they visit your page, whether that's text, images, videos, games, playable
audio tracks, or whatever else.
12. IMAGES
As we said before, it embeds an image into our page in the position it appears. It does this via
the src (source) attribute, which contains the path to our image file.
We have also included an alt (alternative) attribute. In this attribute, you specify descriptive text for users
who cannot see the image, possibly because of the following reasons:
1. They are visually impaired. Users with significant visual impairments often use tools called
screen readers to read out the alt text to them.
2. Something has gone wrong causing the image not to display. For example, try deliberately
changing the path inside your src attribute to make it incorrect. If you save and reload the page,
you should see something like this in place of the image:
The keywords for alt text are "descriptive text". The alt text you write should provide the reader with
enough information to have a good idea of what the image conveys. In this example, our current text of
"My test image" is no good at all. A much better alternative for our Firefox logo would be "The Firefox
logo: a flaming fox surrounding the Earth."
12. HEADINGS
Heading elements allow you to specify that certain parts of your content are headings — or subheadings.
In the same way that a book has the main title, chapter titles, and subtitles, an HTML document can too.
HTML contains 6 heading levels, <h1>–<h6>, although you'll commonly only use 3 to 4 at most:
<h3>My subheading</h3>
<h4>My sub-subheading</h4>
13. PARAGRAPHS
HTML paragraph HTML <p> tag is used to define a paragraph in a webpage. It is a Paired Tag, i.e., it
comes with an opening <p> and a closing </p> tag.
A <p> tag is very important tag, as all the content written on a website needs to get formatted in the
form of paragraphs. Browsers automatically add blank lines above and below a paragraph to separate it
from other content or other paragraphs on the page.
HTML Paragraphs are block level elements, i.e., a new paragraph will always start from a new line.
Also, Paragraph tags gets automatically closed if another block-element gets parsed before the </p> tag.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Paragraph Tag </title>
</head>
<body>
<p> This is First Paragraph </p>
<p> This is Second Paragraph </p>
<p> This is Third Paragraph </p>
</body>
</html>
Output
This is First Paragraph
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Paragraph Tag </title>
</head>
<body>
<p> This is First Paragraph. </p>
<p> This is Second Paragraph. </p>
<p> This is Third Paragraph.</p>
</body>
</html>
Output
This is First Paragraph.
The <pre> tag is also a paired tag. It can be used when you want to display a certain amount of text with
preformatted spaces and line breaks. For example, to display a block of code of a programming language
or to display a poem with proper line breaks.
In the example below, you can see that the text is displayed as it is, in the browser, as it was written
inside the <pre> tag.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Pre Tag </title>
</head>
<p>The pre tag preserves both spaces and line breaks:</p>
<pre>
This is a Paragraph Tag.
This is a Paragraph Tag.
This is a Paragraph Tag.
This is a Paragraph Tag.
</pre>
</body>
</html>
Output
This is a Paragraph Tag.
The <a> tag is a paired tag with </a> tag as a closing tag. Whatever is written between these two tags
will feature as a hyperlink on the webpage.
Syntax
<a href="url">link text</a>
In the example above, the text "Google" will work as a hyperlink and will take the user to our html
tutorial page. We have given the address(Path) of that page as a reference in thehref attribute.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Anchor Tag </title>
</head>
<body>
<a href="https://www.google.com"> Welcome to Google </a>
</body>
</html>
Value Description
_self Opens the linked document in the same window/tab. This is the default value.
_top Opens the linked document in the full body of the window.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Anchor Tag Example </title>
</head>
<body>
<p><a href="https://www.google.com" target="_blank">Welcome to Google</a></p>
<p><a href="https://www. google.com" target="_top"> Welcome to Google </a></p>
<p><a href="https://www. google.com" target="_parent"> Welcome to Google </a></p>
<p><a href="https://www. google.com" target="_top"> Welcome to Google </a></p>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Image Link </title>
</head>
<body>
<p>The image is a link. You can click on it.</p>
<a href="https://www.google.com">
<img src="PUBG.png" alt="HTML Image" style="width:300px;height:200px;">
</a>
</body>
</html>
You can create a base path of your Base Domain. Whenever you give reference to any link, you can
skip the base domain and can directly write latter part. Browser will automatically concatenate the link
with the base path you have given and will make a complete URL.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Base Path Link Example</title>
<base href="https://www.Coderepublics.com" target="_blank">
</head>
<body>
<p> Click following link </p>
<a href="https://www.xyz.com/HTML/html-tutorial.php"> Learn HTML </a>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Change Link Color </title>
</head>
<body alink="green" vlink="red">
<p> Click following link </p>
<a href="https://google.com/"> Welcome to Google </a>
</body>
Syntax
<img src="url" alt="some_text" height="px" width="px">
Example:
<img src="url" alt="some_text" height="px" width="px">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Image Tag </title>
</head>
<body>
<img src="HTML-Image.png" width="400px" height="200px">
</body>
</html>
If a browser cannot find an image, it will display the value of the alt attribute:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Image Alt Attribute </title>
<body>
<img src="HTML-Image.png" alt="HTML5 Image" style="width:400px; height:250px;">
</body>
</html>
The "alt" attribute provides an alternate text for an image, if the user for some reason cannot view it
(because of slow connection, an error in the src attribute, or if the user uses a screen reader).
If a browser cannot find an image, it will display the value of the alt attribute:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Image Alt Attribute </title>
<body>
<img src="HTML-Image.png" alt="HTML5 Image" style="width:400px; height:250px;">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Image Size Attribute </title>
<body>
<img src="HTML5-Image.png" alt="HTML5 Image" width=600px height=250px>
</body>
</html>
Tables are also used in websites to present any data to the user. It looks really neat and also everyone
prefers tabular form of data nowadays. The HTML tables allows to arrange data like text, images, etc.
into rows and columns.
<!DOCTYPE html>
<html lang="en">
<HTML>
<head>
<meta charset="UTF-8">
<title> HTML Table </title>
</head>
<body>
<table>
<tr>
<th> Name </th>
<th> Salary </th>
<th> Age </th>
</tr>
<tr>
<td> Anshuman </td>
<td> Rs. 2,00,000 </td>
<td> 25 </td>
</tr>
<tr> <td> Kuldeep </td>
<td> Rs. 5,00,000 </td>
<td> 22 </td>
</tr>
</table> </body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Table Border Attribute </title>
</head>
<body>
<table border="1" width="100%">
<tr>
<th> Name </th>
<th> Salary </th>
<td> 22 </td>
</tr>
</table>
</body>
</html>
CELLPADDING ATTRIBUTE
The Cellpadding attribute is used to specify the space between the content of the cell and its borders. It
provides padding to the content of the cell. As its value increases the space between the cell’s content
and its border is also increases. The value of this attribute is taken in pixels by the browser. The
cellpadding is applied to all the four sides of the content. The value can also be defined in percentages.
CELLSPACING ATTRIBUTE
The Cellspacing attribute is used to specify the space between the cells of the table. Its value can be in
pixels or in percentages. It works similar to the Cellpadding attribute but only between cells. It is applied
to all the sides of the cells.
Note: These two attributes defined above are no longer a part of HTML 5. So it is better to use CSS to
color the tables.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Table Cellpadding Attribute </title>
</head>
<body>
<table border="1" cellpadding="5" cellspacing="5" style="width:100%">
<tr>
<th>Name</th>
<th>Salary</th>
</tr>
<tr>
<td>Peter</td>
<td>5000</td>
</tr>
<tr>
<td>John</td>
<td>7000</td>
</tr>
</table>
</body>
</html>
The 'Rowspan'
The rowspan attribute is used to merge two or more rows together to form a single row. A single row
occupies space of the number of merged rows.
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
</head>
<body>
<h2>Cell that spans two rows:</h2>
<table style="width:100%">
<tr>
<th>Name:</th>
<td>Bill Gates</td>
</tr>
<tr>
<th rowspan="2">Telephone:</th>
<td>9998887776</td>
</tr>
<tr>
<td>9998887776</td>
</tr>
</table>
</body>
</html>
The 'Colspan'
The colspan attribute is used to merge two or more columns into a single column. single column
occupies space of the number of merged columns.
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Table Colspan Attribute </title>
</head>
<body>
<table border="1" width="80%">
<tr>
<th> Person_Name </th>
<th colspan="2"> Mobile </th>
</tr>
<tr>
<td> Bill Gates </td>
<td> 9998887776 </td>
<td> 9998887775 </td>
</tr>
</table>
</body>
</html>
• A caption can be aligned around the table by using align attribute with values -
left/right/top/bottom.
• The default alignment is top.
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Table Caption Attribute </title>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
</body>
</html>
Ex.-For a numbered order list, the numbering starts at one and is incremented by one for each
successive ordered list element tagged with <li>.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Ordered List </title>
</head>
<body>
<h2>HTML Ordered list</h2>
<ol>
<li>Audi</li>
<li>Mercedes</li>
<li>Lamborghini</li>
</ol>
</body>
</html>
type ATTRIBUTE
The type attribute is used to change the series type.
Value Description
type="I" The list items will be numbered with uppercase roman numbers.
type="i" The list items will be numbered with lowercase roman numbers.
LIST OF NUMBERS
Numbers as type - <ol type="1">. Here the numbers will be used to order the elements. Each new
element will get incremented value from the previous one in the list.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Ordered List </title>
</head>
<body>
<h2>HTML Ordered list</h2>
<ol>
<li>Audi</li>
<li>Mercedes</li>
<li>Lamborghini</li>
</ol>
</body>
</html>
Uppercase
Uppercase alphabets as type - <ol type="A">. Here, Uppercase alphabets will be used to order the
elements.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Ordered List Uppercase </title>
</head>
<body>
<ol type="A">
<li>Audi</li>
<li>Mercedes</li>
<li>Lamborghini</li>
</ol>
</body>
</html>
Lowercase
Lowercase alphabets as type - <ol type="a">. Same as above, but the alphabets will be lowercased.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Ordered List Lowercase </title>
</head>
<body>
<ol type="a">
<li>Audi</li>
<li>Mercedes</li>
<li>Lamborghini</li>
</ol>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Ordered List Uppercase Roman </title>
</head>
<body>
<ol type="I">
<li>Audi</li>
<li>Mercedes</li>
<li>Lamborghini</li>
</ol>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Ordered List Start Attribute </title>
</head>
<body>
<ol start="50">
<li>Samsung</li>
<li>OnePlus</li>
<li>Nokia</li>
</ol>
<ol type="I" start="50">
<li>Oppo</li>
<li>Vivo</li>
<li>Xiaomi</li>
</ol>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Unordered List </title>
</head>
<body>
<h2> Unordered List </h2>
<ul>
<li> Harley-Davidson </li>
<li> Ducati </li>
<li> BMW </li>
</ul>
</body>
</html>
Value Description
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Unordered List Disc Attribute </title>
</head>
<body>
<h2> Unordered List </h2>
<ul type="disc">
<li> Harley-Davidson </li>
<li> Ducati</li >
<li> BMW </li>
</ul>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Unordered List Circle Attribute </title>
</head>
<body>
<h2> Unordered List </h2>
<ul type="circle">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Unordered List Square Attribute </title>
</head>
<body>
<h2> Unordered List </h2>
<ul type="square">
<li> Harley-Davidson </li>
<li> Ducati </li>
<li> BMW </li>
</ul>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Unordered List None Attribute </title>
</head>
<body>
<h2> Unordered List </h2>
<ul type="none">
<li> Harley-Davidson </li>
<li> Ducati </li>
<li> BMW </li>
</ul>
</body>
</html>
HTML support another list style which is called definition lists where entries are listed like in a
dictionary. The definition list is the ideal way to present a list of terms, or other name/value list.
The definition list created using <dl> tag. The Description <dt> — defines the item in the list,
and <dd> describes the items in the list.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Definition List</title>
</head>
<body>
<h1>HTML Definition List</h1>
<dl>
<dt>PUBG</dt>
<dd>PlayerUnknown's Battlegrounds (PUBG) developed by PUBG Corporation.</dd>
<dt>God Of War</dt>
<dd>God of War developed by Santa Monica Studio.</dd>
</dl>
</body>
</html>
Syntax:
<form>
....
Form Elements..
....
</form>
Attributes Description
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Select Attribute </title>
</head>
<body>
<form action="action-page.php">
<select name="Cars">
<option value="Audi"> Audi </option>
<option value="Mercedes"> Mercedes </option>
<option value="Lamborghini"> Lamborghini </option>
</select>
<input type="submit">
</form>
</body>
</html>
Note: The action attribute defines the action to be performed when the form is submitted. You should
add the destination where the form is submitted.
BASIS FOR
GET POST
COMPARISON
Form data type constraints Only ASCII characters are No constraints, even binary data is
permitted. permitted.
Form data length Should be kept as minimum as Could lie in any range.
possible.
Caching Method data can be cached. Does not cache the data.
Syntax
<form action="action-page.jsp" method="get">
<form action="action-page. jsp " method="post">
</body>
</html>
Grouping Form Data with <fieldset>
The <fieldset> element is used to group related data in a form and the <legend> element defines a
caption for the <fieldset> element.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Fieldset and Legend Attributes </title>
</head>
<body>
<form action="action-page.php">
<fieldset>
<legend>Personal information:</legend>
First name:
<input type="text" name="firstname" value="John">
Last name:
<input type="text" name="lastname" value="Snow">
<input type="submit" value="Submit">
</fieldset>
</form>
</body>
</html>
Type Description
Type Description
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Input Type Text </title>
</head>
<body>
<form action="action-page.php">
First name:
<input type="text" name="firstname">
Last name:
<input type="text" name="lastname">
<input type="submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Input Type Password </title>
</head>
<body>
<form action="#">
User name:
<input type="text" name="userid">
User password:
<input type="password" name="psw">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Input Type Submit </title>
</head>
<body>
<form action="action-page.php">
First name:
<input type="text" name="firstname" value="John">
Last name:
<input type="text" name="lastname" value="Snow">
<input type="submit" value="Submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Input Type Reset </title>
</head>
<body>
<form action="action-page.php">
First name:<br>
<input type="text" name="firstname" value="John">
Last name:<br>
<input type="text" name="lastname" value="Snow">
<input type="submit" value="Submit">
<input type="reset">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Input Type Radio Button </title>
</head>
<body>
<form action="action-page.php">
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other<br><br>
<input type="submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Input Type Checkbox </title>
</head>
<body>
<form action="action-page.php">
<input type="checkbox" name="vehicle1" value="Bike">Samsung
<input type="checkbox" name="vehicle2" value="Car">Google Pixel>
<input type="submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Input Type Button </title>
</head>
<body>
<input type="button" onclick="alert('Hello World!')" value="Click Me!">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Input Type Number </title>
</head>
<body>
<form action="action-page.php">
Quantity (between 1 and 10):
<input type="number" name="quantity" min="1" max="10">
<input type="submit">
</form>
</body>
</html>
Attribute Description
Attribute Description
readonly It specifies that an input field is read only that cannot be changed.
Email Fields
The value "email" is used for creating an input field for email address. This HTML input type is
specifically used to validate the email address entered by the user. It uses the standard email address
format and the user violates it then it shows error. Syntax: <input type=email>
Number Fields
The value "number" will create an input field to enter only numbers, if you enter alphabets or symbols
or anything other than numbers, it will show an error, however decimal points numbers are
allowed. Syntax:<input type=number>
Search Fields
It is used to create a search box. You can even add placeholder in the search box by using the
‘placeholder’ attribute. Syntax: <input type="search">
URL Fields
Specifically used to enter a URL. Syntax: <input type="url">
Number Fields
This HTML input type provides controls to enter numbers. It has small buttons on the right side to
increase or decrease the value of the number. In your smartphones this input type automatically opens
the numeric keyboard during entering the data. Syntax:<input type="number">
Range Fields
It creates a slider to select a value in within a range of two values. Syntax: <input type="range" min="0"
max="10">
Date Fields
This type is used to create an input area to enter date. You can manually enter the date or can select
value from a graphical calendar. Syntax:<input type="date">
Month Fields
It only provides options of Month and year. Syntax:<input type="month">
Week Fields
Allows you to pick the week and year. Syntax:<input type="week">
Time Fields
Allows you to enter time of the day. It can be entered manually or by the help of a digital clock
format. Syntax:<input type="time">
Datetime-local Fields
Enter Date and time together in a single input field. Syntax:<input type="datetime-local">
Color Fields
If you want to enter any RGB color information on the database then use this input type. Syntax:<input
type="color">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Value Attribute </title>
</head>
<body>
<form action="#">
First name:
<input type="text" name="firstname" value="John">
Last name:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Readonly Attribute </title>
</head>
<body>
<form action="#">
First name:
<input type="text" name="firstname" value ="John" readonly>
Last name:
<input type="text" name="lastname">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Disabled Attribute </title>
</head>
<body>
<form action="#">
First name:
<input type="text" name="firstname" value ="John" disabled>
Last name:
<input type="text" name="lastname">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form Size Attribute </title>
</head>
<body>
<form action="#">
First name:
<input type="text" name="firstname" value="John" size="30">
Last name:
<input type="text" name="lastname">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Form maxlength Attribute </title>
</head>
<body>
<form action="#">
First name:
<input type="text" name="firstname" maxlength="10">
Last name:
<input type="text" name="lastname">
</form>
</body>
</html>
Note : The maxlength attribute, will not accept more than the allowed number of characters in input
field.
HTML <frameset> tag is used to contain the group of frames which can be controlled and styled as a unit.
The <frameset> element also specifies the number of rows and columns in the frameset, and how much
space they will occupy in a frame.
Note: Do not use HTML <frameset> element as it is deprecated and not supported by HTML5,
but you can use <iframe> tag instead.
Syntax
<frameset cols=" ">............</frameset>
Display Block
Usage Frames
Example 1
<!DOCTYPE html>
<html>
<head>
<title>Frame tag</title>
</head>
<frameset cols="50%,50%">
<frame src="xyz/html-table">
<frame src="xyz/css-table">
</frameset>
</html>
Tag-specific attribute
Attribute Value Description
cols Pixels It specifies the number and size of column spaces in the frameset. (Not
% Supported in HTML5)
*
rows Pixels It specifies the number and size of the rows spaces in the frameset.
% (Not Supported in HTML5)
*