Sudhakar Sharma UI Notes
Sudhakar Sharma UI Notes
What is DHTML?
- Dynamic HTML. [Obsolete – No Longer in use]
What is HTML?
- It is a markup language.
- It is used for presentation.
- HTML is used to present DOM.
What is DOM?
- Browser presents content in a hierarchy called
DOM.
- Document Object Model
- It is a hierarchy used to present contents in HTML.
Image - Element
<img> - Tag
Anchor - Element
<a> - Tag
Bold - Element
<b> - Tag
Document Declaration:
- It comprises of information about HTML version.
- It informs the parser that we are using HTML 5 to
design web page.
- The document declaration in HTML 5 is defined by
using the following Entity
<!DOCTYPE html>
Head Section:
- Head section comprises of content, which is
intended to load into memory when page is
requested by client.
- The content from memory of browser can be
accessed by page or browser when ever required.
- Typically head section is defined with <head>
</head>
- It comprises of contents like
o Title
o Link
o Meta
o Script
o Style
Title Element:
- It comprises of title, which is displayed in the
browser title bar.
- The title is also used in bookmarking the page.
<html lang="en-IN">
<head>
<title>Amazon Shopping</title>
</head>
</html>
Link Element:
- It is used to link external files to your web page.
- External files include short cut icons, stylesheets
etc.
Ex: Link Shortcut Icon to Web Page [Favicon]
- Favicon must be an “icon” file with extension
“.ico”
- Size of icon is between 16x16 pixels and 32x32
pixels
<!--Document declaration-->
<!DOCTYPE html>
<!--Document Scope-->
<html lang="en-IN">
<head>
<title>Amazon Shopping</title>
<link rel="shortcut icon"
href="../Icons/favicon.ico">
<meta charset="utf-8">
<meta name="keywords" content="Best Software
Traning, Best IT Training, in Hyd, Chennai, US">
<meta name="description" content="something
about your website..">
<meta name="author" content="Author Name for
Blog">
<meta http-equiv="refresh" content="4">
</head>
</html>
Body Section
- It comprises of content to display in browser
workspace.
- The body section is configured by using “<body>”
element.
Syntax:
<body>
Some content
</body>
- Body tag comprises following attributes
Attribute Description
bgcolor It sets a background color for page.
text It sets color for text in page.
[Foreground color]
Ex:
<body bgcolor="red"
text="yellow">
Welcome to Amazon
Shopping
</body>
backgroun It sets a background image for body
d section.
Ex:
<body
background="../Images/banner3.jp
g" text="white">
Welcome to Amazon
Shopping
</body>
alink It defines color for active link.
vlink It defined color for visited link.
Ex:
<body vlink="green" alink="red">
<a href="home.html">Home</a>
<a
href="http://www.amazon.in">Am
azon</a>
</body>
leftmargin Sets the space between the content
rightmargi and browser window.
n Ex:
topmargin <body leftmargin="50"
bottommar rightmargin="50" topmargin="50"
gin bottommargin="20">
Some paragraph..
</body>
align It aligns the entire body content to
left, center, right or justify
Ex:
<body align=”justify”>
</body>
- Line Breaks
o Browser ignores the line breaks given in
editor.
o You have to manually add line break by using
“<br>” element.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
</head>
<body>
Welcome to HTML.<br>
This is our static Page.<br> <br>
Contents in body section <br> without semantics.
</body>
</html>
FAQ: What is difference between <br> and <br/>?
- There is not such element called “<br/>” in HTML.
- Always use only <br>
- <br/> is used to indicate that it is a self-ending or
void element.
- Blank Spaces
o Browser ignores additional spaces between
words and characters.
o Browser allows only one characters space
between words or chars.
o To add manual space, you have to use
“ ” [non-breakable space].
o It is “Raw Text Element”
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
</head>
<body>
H T M L
</body>
</html>
- Pre-formatted Text
o It is used to present the content exactly as
defined in source code.
o It will keep the spaces and line breaks are
defined in editor.
o The content must be defined with-in “<pre>”
element.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
<style>
pre {
background-color: lightgrey;
border:2px solid black;
padding:10px;
width: 400px;
}
</style>
</head>
<body>
<div>Sample C Program</div>
<div>
<pre>
#include <stdio.h>
main
{
printf("Welcome to HTML");
}
</pre>
</div>
</body>
</html>
- Code Element
o <code> is an element used to define code
snippet in web page.
o It allows to browser and SEO to understand
that the content enclosed in some computer
code.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
<style>
pre {
background-color: lightgrey;
border:2px solid black;
padding:10px;
width: 400px;
}
</style>
</head>
<body>
<div>Sample C Program</div>
<div>
<pre>
<code>
#include <stdio.h>
main
{
printf("Welcome to HTML");
}
</code>
</pre>
</div>
</body>
</html>
Note:
- Don’t use headings for highlighting any word or
sentence in a paragraph.
- Heading by default will have line break above and
below.
- Don’t use too many headings in a page. SEO can
SPAM your page.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
</head>
<body>
<h1 align="center">HTML</h1>
<h2>Web Terminology</h2>
<h3>Web Site</h3>
It is a virtual directory on web server.
<h3>Web Page</h3>
It is a Hypertext document.
</body>
</html>
</details>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
</head>
<body>
<h2>Amazon Shopping</h2>
<details>
<summary>Electronics</summary>
<dl>
<dd>Televisions</dd>
<dd>Cameras</dd>
<dd>Watches</dd>
</dl>
</details>
<details>
<summary>Footwear</summary>
<dl>
<dd>Sports</dd>
<dd>Sneakers</dd>
<dd>Casuals</dd>
</dl>
</details>
</body>
</html>
</fieldset>
<fieldset>
<legend align="center">Annexure-2</legend>
JavaScript is used for client side interactions.
Depending on how you obtained the Windows
software, this is a license agreement between (i) you
and the device manufacturer or software installer that
distributes the software with your device; or (ii) you
and Microsoft Corporation (or, based on where you
live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired
the software from a retailer. Microsoft is the device
manufacturer for devices produced by Microsoft or
one of its affiliates, and Microsoft is the retailer if you
acquired the software directly from Microsoft. Note
that if you are a volume license customer, use of this
software is subject to your volume license agreement
rather than this agreement.
</fieldset>
</body>
</html>
Paragraphs and Blockquotes
- HTML ignores the line breaks and paragraph
marks.
- You have to manually add paragraphs by using <p>
element.
- It supports “align” attribute, which can set text
left, center, right or justified.
- Paragraphs will have a line break before and after.
Syntax:
<p>
Your Content
</p>
- Blockquote is similar to paragraph but have left
and right indentation for text.
[Indentation is space between margin and text]
- It is defined by using “<blockquote>” element.
- In SEO blockquote is used a summary for content
in page.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Paragraph</title>
<style>
blockquote {
padding-left: 150px;
padding-right: 150px;
font-style: italic;
border-top: 2px double darkcyan;
border-bottom: 2px double darkcyan;
width: 400px;
}
</style>
</head>
<body>
<blockquote align="justify">
Depending on how you obtained the Windows
software, this is a license agreement between (i) you
and the device manufacturer or software installer
that distributes the software with your device; or (ii)
you and.
</blockquote>
<p align="justify">
This agreement describes your rights and the
conditions upon which you may use the Windows
software. You should review the entire agreement,
including any supplemental license terms that
accompany the software and any linked terms,
because all of the terms are important and together
create this agreement that applies to you. You can
review linked terms by pasting the (aka.ms/) link into
a browser window.
</p>
<p align="justify">
Microsoft Corporation (or, based on where
you live or, if a business, where your principal place
of business is located, one of its affiliates) if you
acquired the software from a retailer. Microsoft is
the device manufacturer for devices produced by
Microsoft or one of its affiliates, and Microsoft is the
retailer if you acquired the software directly from
Microsoft. Note that if you are a volume license
customer, use of this software is subject to your
volume license agreement rather than this
agreement.
</p>
</body>
</html>
Ex:
<ol lang="hi" >
<li>Internet</li>
<li>Web Server</li>
<li>Web Site</li>
<li>Web Page</li>
</ol>
</style>
</head>
<body>
<ul>
<li>Web Sever
<ul>
<li>IIS</li>
<li>Apache Tomcat</li>
</ul>
</li>
<li>Web Site</li>
<li>Web Page
<ul type="square">
<li>Static Page</li>
<li>Dynamic Page</li>
</ul>
</li>
</ul>
</body>
</html>
List can be “Assorted” with combination of Ordered
and Unordered:
Ex:
<body>
<ol type="I">
<li>HTML
<ol>
<li>Normal Elements
<ul type="circle">
<li>Bold</li>
<li>Italic</li>
</ul>
</li>
<li>Void Elements
<ul type="circle">
<li>Image</li>
<li>Break</li>
</ul>
</li>
</ol>
</li>
<li>JavaScript</li>
</ol>
</body>
Library for Icons and Symbols used in real-world
application development
“Fontawesome”
- Visit the following URL
https://fontawesome.com/how-to-use/on-the-
web/setup/hosting-font-awesome-yourself
- Click on
“Download Fontawesome Free for Web”
- It will download “fontawesome ZIP” folder
- Extract the ZIP folder and copy all its sub folders
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Menu</title>
<link rel="stylesheet" href="../fonts/css/all.css">
<style>
ul {
list-style: none;
}
li {
margin-top: 20px;
border:1px solid darkcyan;
padding: 5px;
width: 200px;
background-color: lightcyan;
color:blue;
}
</style>
</head>
<body>
<ul>
<li> <span class="fa fa-home"></span>
<span>Home</span></li>
<li> <span class="fa fa-tv"></span>
Electronics</li>
<li> <span class="fa fa-tshirt"></span>
Fashion</li>
<li> <span class="fa fa-shoe-prints"></span>
Footwear</li>
<li> <span class="fa fa-bell"></span>
Notifications</li>
<li> <span class="fa fa-user"></span> Login</li>
</ul>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Fontawesome</title>
<link rel="stylesheet" href="../fonts/css/all.css">
<style>
ul {
list-style: none;
width: 140px;
}
li{
margin-top: 10px;
border-bottom: 1px solid gray;
padding: 10px;
}
li:hover {
background-color: black;
color:white;
cursor:grab;
}
</style>
</head>
<body>
<ul>
<li><span class="fa fa-home"></span>
<span>Home</span> </li>
<li><span class="fa fa-user-circle"></span>
<span>Profile</span> </li>
<li><span class="fa fa-bell"></span>
<span>Notifications</span> </li>
</ul>
</body>
</html>
Element Description
<font> It is used to configure the
following options for text
- Face: It defines font family
like, Arial, Time New Roman,
Sans-Serif etc.
Ex:
<font face="Segoe Script">
Welcome to HTML
</font>
- Size: It defines the font size,
which can be from 1 to 7
levels. [Default size is 3]
- Color: It defines color for text.
Ex:
<body>
<font face="Arial" color="red" size="5">Welcome
to HTML</font>
</body>
Ex:
<body>
<font size="4" color="red">W</font>
<font size="5" color="blue">E</font>
<font size="6" color="green">L</font>
<font size="7" color="yellow">C</font>
<font size="6" color="green">O</font>
<font size="5" color="blue">M</font>
<font size="4" color="red">E</font>
</body>
Colors in HTML
- Color Names:
o HTML allows you to define 16 Million colors.
o Only 17 colors are known by their name.
Aqua
Blue
Gray
Lime
Navy
Orange
Red
Teal
Yellow
Black
Fuchsia
Green
Maroon
Olive
Purple
Silver
White
Transparent
o HTML also support hundreds of color shade
names
Darkcyan
Lightcyan
Lightgreen etc..
Ex:
<body bgcolor=”lightgreen”> </body>
Hexa: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f
[0 is minimum, f is maximum]
- First place is for Red
- Second Place is for Green
- Third place is for Blue
Ex:
#FF0000 - Red #F00
#00FF00 - Green #0F0
#0000FF - Blue #00F
#FFFF00 - Yellow #FF0
#000000 - Black #000
#FFFFFF - White #FFF
Ex:
<body bgcolor=”#ff00ff”> </body>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Font</title>
<link rel="stylesheet" href="../fonts/css/all.css">
<style>
#rating {
background-color: green;
color:white;
font-weight: bold;
padding: 4px;
border-radius: 5px;
}
li {
margin-bottom: 5px;
}
ul {
margin-left: -20px;
}
</style>
</head>
<body>
<table width="1000">
<tr valign="top">
<td>
<div>
<img src="../Images/mobile.PNG">
</div>
</td>
<td>
<div>
<div>
<b><font face="sans-serif" color="blue"
size="5">Realme 7 (Mist Blue, 64 GB)</font></b>
<br>
<font face="arial" color="gray">
<span id="rating">4.3 <span class="fa
fa-star"></span> </span>
1,73,000 Ratings & 18,000 Reviews
</font>
<br>
<font color="gray" face="arial">
<ul>
<li>6 GB RAM | 64 GB ROM |
Expandable Upto 256 GB</li>
<li>16.51 cm (6.5 inch) Full HD+
Display</li>
<li>64MP + 8MP + 2MP + 2MP |
16MP Front Camera</li>
<li>5000 mAh Lithium-ion
Battery</li>
<li>MediaTek Helio G95
Processor</li>
</ul>
</font>
</div>
</div>
</td>
<td>
<div>
<font face="arial" size="5">
<b>
₹ 14,999
</b>
</font>
<br>
<font color="gray" face="arial">
<strike>₹ 17,000</strike>
</font>
<font color="green" face="arial">
16% Off
</font>
<br>
Upto <font face="arial"><b>₹
13,200 </b></font> off on Exchange.
</div>
</td>
</tr>
</table>
</body>
</html>
Images in HTML
- The HTML <img> tag is used to embed images into
page.
- Browser can’t support all image types.
- Whenever you are configuring images, browser
verifies its “MIME” type.
- MIME [Multipurpose Internet Mail Extension]
Ex:
Flower.jpg image/jpeg [MIME Type]
Flower.jpeg
Flower.jfif
Flower.pjpeg
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Images in HTML</title>
</head>
<body>
<img hspace="20" vspace="20" title="Copyright of
Amazon" alt="Please Wait.. Enable Images on Browser"
src="../Images/nike.jpg" align="left" border="10"
width="200" height="200">
<p>Depending on how you obtained the Windows
software, this is a license agreement between (i) you
and the device manufacturer or software installer that
distributes the software with your device; or (ii) you
and Microsoft Corporation (or, based on where you
live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired
the software from a retailer. Microsoft is the device
manufacturer for devices produced by Microsoft or
one of its affiliates, and Microsoft is the retailer if you
acquired the software directly from Microsoft. Note
that if you are a volume license customer, use of this
software is subject to your volume license agreement
rather than this agreement.
</p>
<p>Depending on how you obtained the Windows
software, this is a license agreement between (i) you
and the device manufacturer or software installer that
distributes the software with your device; or (ii) you
and Microsoft Corporation (or, based on where you
live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired
the software from a retailer. Microsoft is the device
manufacturer for devices produced by Microsoft or
one of its affiliates, and Microsoft is the retailer if you
acquired the software directly from Microsoft. Note
that if you are a volume license customer, use of this
software is subject to your volume license agreement
rather than this agreement.
</p>
<p>Depending on how you obtained the Windows
software, this is a license agreement between (i) you
and the device manufacturer or software installer that
distributes the software with your device; or (ii) you
and Microsoft Corporation (or, based on where you
live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired
the software from a retailer. Microsoft is the device
manufacturer for devices produced by Microsoft or
one of its affiliates, and Microsoft is the retailer if you
acquired the software directly from Microsoft. Note
that if you are a volume license customer, use of this
software is subject to your volume license agreement
rather than this agreement.
</p>
</body>
</html>
- Image attributes which are used with integration
of server-side technologies.
Attribute Description
crossorigin It specifies the accessibility of
resources from cross-origin. [CORS
– Cross Origin Resource Sharing]
- Allow Anonymous [Allow All to
access]
- Use Credentials [Need
Authentication]
Ex:
<img crossorigin="anonymous"
src="https://cdn/Images/nike.jpg"
width="200" height="200">
decoding It specifies how to load the image
along with other content in page.
- Sync: Synchronized, it will block
other content while loading
image.
- Async: Allows to load image
along with other contents.
Ex:
<img decoding="async"
src="../Images/nike.jpg"
width="200" height="200">
Importance - It defines the priority for
image.
- It can be low, high or auto.
- Images with high priority are
loaded first.
Ex:
<img importance="auto"
src="../Images/nike.jpg"
width="200" height="200">
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Images in HTML</title>
<style>
.card {
width: 250px;
padding: 10px;
border:2px solid darkcyan;
border-radius: 10px;
margin:30px;
}
.card-header {
text-align: center;
background-color:lightgoldenrodyellow;
font-size: 26px;
padding:3px;
}
.card-footer {
text-align: center;
background-color:lightgoldenrodyellow;
padding: 3px;
}
.card-img {
border:2px solid darkcyan;
border-radius: 100px;
}
.card-body {
text-align: center;
}
.card-deck {
display: flex;
}
</style>
</head>
<body>
<div class="card-deck">
<div class="card">
<div class="card-body">
<img class="card-img"
src="../Images/shoe.jpg" width="200"
height="200">
</div>
<div class="card-header">
<h3>Nike Casuals</h3>
</div>
<div class="card-footer">
<p>₹ 6700.66</p>
<p>more..</p>
</div>
</div>
<div class="card">
<div class="card-header">
<h3>Lee Boot</h3>
</div>
<div class="card-body">
<img class="card-img"
src="../Images/shoe1.jpg" width="200"
height="200">
</div>
<div class="card-footer">
<p>₹ 7000.66</p>
<p>more..</p>
</div>
</div>
<div class="card">
<div class="card-header">
<h3>Shirt</h3>
</div>
<div class="card-footer">
<p>₹ 4000.66</p>
<p>more..</p>
</div>
<div class="card-body">
<img class="card-img"
src="../Images/shirt.jpg" width="200"
height="200">
</div>
</div>
<div class="card">
<div class="card-header">
<h3>Jeans</h3>
</div>
<div class="card-body">
<img class="card-img"
src="../Images/jeans.jpg" width="200"
height="200">
</div>
<div class="card-footer">
<p>₹ 3000.66</p>
<p>more..</p>
</div>
</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Card</title>
<style>
.card {
width: 300px;
border:2px solid black;
border-top-left-radius:20px;
border-top-right-radius: 20px;
margin:30px;
}
.card-body {
padding: 10px;
text-align: justify;
font-family: Arial;
}
.card-img {
border-top-left-radius:20px;
border-top-right-radius: 20px;
}
.card-deck {
display: flex;
}
</style>
</head>
<body>
<div class="card-deck">
<div class="card">
<div>
<img class="card-img"
src="../Images/wild.jpg" width="100%" height="250">
</div>
<div class="card-body">
<h3>Wild Life</h3>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its </p>
</div>
</div>
<div class="card">
<div>
<img class="card-img"
src="../Images/wild.jpg" width="100%" height="250">
</div>
<div class="card-body">
<h3>Wild Life</h3>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its </p>
</div>
</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Card</title>
<style>
.card {
width: 300px;
border:2px solid black;
border-top-left-radius:20px;
border-top-right-radius: 20px;
margin:30px;
}
.card-body {
padding: 10px;
text-align: justify;
font-family: Arial;
}
.card-img {
border-top-left-radius:20px;
border-top-right-radius: 20px;
}
.card-deck {
display: flex;
}
</style>
</head>
<body>
<div class="card-deck">
<div class="card">
<div>
<img class="card-img"
src="../Images/wild.jpg" width="100%" height="250">
</div>
<div class="card-body">
<h3>Wild Life</h3>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its </p>
</div>
</div>
<div class="card">
<div>
<img class="card-img"
src="../Images/wild.jpg" width="100%" height="250">
</div>
<div class="card-body">
<h3>Wild Life</h3>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its </p>
</div>
</div>
</div>
</body>
</html>
Hyperlinks in HTML
- Link is clickable text, picture or graphic that
navigates the user to any specified location when
clicked.
- Hyperlink is clickable text, picture of graphics that
navigates over “Http”.
- Hyperlinks are required to design navigation in
website.
Note: According the Web Designing standards every
website must have a proper navigation mechanism.
User must able to reach to any topic just with one
click.
- HTML Hyperlinks are created by using “Anchor”
Element.
- Anchor is designed by using “<a>” tag.
- Hyperlinks in Website are classified into 2 types
o Intra document links
o Inter document links
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Intra Document Navigation</title>
<link rel="stylesheet" href="../fonts/css/all.css">
<style>
.container {
display: flex;
column-count: 2;
column-gap: 60px;
}
.content {
height: 400px;
overflow: scroll;
}
ul {
list-style: none;
}
li {
width: 100px;
margin-top: 20px;
border:2px solid darkcyan;
padding: 5px;
border-radius: 5px;
background-color: darkcyan;
color:white;
}
a{
color:white;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<div class="navbar">
<ul>
<li> <a href="#electronics"><span class="fa fa-
tv"></span> Electronics</a> </li>
<li> <a href="#footwear"><span class="fa fa-
shoe-prints"></span> Footwear</a></li>
<li> <a href="#fashion"><span class="fa fa-
tshirt"></span> Fashion</a></li>
</ul>
</div>
<div class="content">
<h2 id="electronics">Electronics</h2>
<img src="../Images/speaker.jpg" width="100"
height="100">
<img src="../Images/earpods.jpg" width="100"
height="100">
<p>Depending on <span><a style="color:blue"
href="#wild">See:Wild Life</a></span> how you
obtained the Windows software, this is a license
agreement between (i) you and the device
manufacturer or software installer that distributes the
software with your device; or (ii) you and Microsoft
Corporation (or, based on where you live or, if a
business, where your principal place of business is
located, one of its affiliates) if you acquired the
software from a retailer. Microsoft is the device
manufacturer for devices produced by Microsoft or
one of its affiliates, and Microsoft is the retailer if you
acquired the software directly from Microsoft. Note
that if you are a volume license customer, use of this
software is subject to your volume license agreement
rather than this agreement.</p>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
<h2 id="footwear">Footwear</h2>
<img src="../Images/shoe.jpg" width="100"
height="100">
<img src="../Images/shoe1.jpg" width="100"
height="100">
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
<h2 id="fashion">Fashion</h2>
<img src="../Images/jeans.jpg" width="100"
height="100">
<img src="../Images/shirt.jpg" width="100"
height="100">
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
<div id="wild">
<img src="../Images/wild.jpg" width="200"
height="200">
</div>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
</div>
</div>
</body>
</html>
- Intra document links can use target selector of
“css” in order to highlight the target content if it
is not scrollable.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Intra Document Links</title>
<style>
ul {
list-style: none;
display: flex;
margin-left: -60px;
}
li {
margin-left: 30px;
border:2px solid darkcyan;
background-color: darkcyan;
width: 200px;
padding: 5px;
text-align: center;
}
a{
color:white;
text-decoration: none;
}
.topic {
border:2px solid darkcyan;
padding: 10px;
background-color: darkcyan;
color:white;
margin-top: 20px;
}
.topic:target {
background-color: black;
color:white;
}
</style>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="#html">HTML</a></li>
<li><a href="#css">CSS</a></li>
<li><a href="#js">JavaScript</a></li>
</ul>
</nav>
</header>
<div id="html" class="topic">
<h2>HTML</h2>
<p>It is a markup language..</p>
</div>
<div id="css" class="topic">
<h2>CSS</h2>
<p>It defines styles for HTML</p>
</div>
<div id="js" class="topic">
<h2>JavaScript</h2>
<p>It is a language.</p>
</div>
</body>
</html>
Note:
- Every file that you configured as target in
Hyperlink can’t open in browser. Files require
special plugins to open the content and show in
browser.
- If plugin is missing on not available then the linked
file will be downloaded.
Ex:
- Add “Pages” folder in your project
- Add following files into folder
o Home.html
o Electronics.html
o Footwear.html
o Fashion.html
- Add another file in “public” folder
o Index.html
“Code you can find in Pages attached to notes”
Frames in HTML
[Obsolete – No Longer in use]
- HTML provides <frameset> that can split the
browser window into multiple windows.
- <frameset> is a collection of “frames”.
- Every frame is designed by using <frame>.
Note: It is not embedding the content into page. It is
splitting the window into horizontal or vertical panes.
- The document that is designed with frame can’t
contain body section.
Syntax:
<!DOCTYPE html>
<html>
<head>
<title>Shopping | Online</title>
</head>
<frameset rows="15%, 70%, 15%">
<frame></frame>
<frame></frame>
<frame></frame>
</frameset>
</html>
- You can’t add any content directly inside frame.
- Frame can handle only a document [Picture, PDF,
text, HTML] by using “src” attribute.
Syntax:
<!DOCTYPE html>
<html>
<head>
<title>Shopping | Online</title>
</head>
<frameset rows="15%, 70%, 15%">
<frame></frame>
<frame src="../Pages/home.html"></frame>
<frame></frame>
</frameset>
</html>
Ex:
1. Add following files into “Pages”
a. Menu.html
b. Footwer.html
c. Home.html
d. Electronics.html
e. Footwear.html
f. Fashion.html
2. Menu.html
<head>
<link rel="stylesheet" href="../fonts/css/all.css">
<style>
ul {
list-style: none;
}
li {
width: 100px;
padding:10px;
margin-top: 30px;
background-color: darkcyan;
color:white;
}
a{
text-decoration: none;
color:white;
}
</style>
</head>
<body>
<ul>
<li><a href="../Pages/home.html"
target="frameBody"> <span class="fa fa-
home"></span> Home</a></li>
<li><a href="../Pages/electronics.html"
target="frameBody"> <span class="fa fa-
tv"></span> Electronics</a></li>
<li><a href="../Pages/footwear.html"
target="frameBody"> <span class="fa fa-shoe-
prints"></span> Footwear</a></li>
<li><a href="../Pages/fashion.html"
target="frameBody"> <span class="fa fa-
tshirt"></span> Fashion</a></li>
</ul>
</body>
3. Index.html
<!DOCTYPE html>
<html>
<head>
<title>Shopping | Online</title>
</head>
<frameset cols="15%, 70%, 15%" noresize>
<frame src="../Pages/menu.html"></frame>
<frame name="frameBody"
src="../Pages/home.html"></frame>
<frame src="../Pages/footer.html"></frame>
</frameset>
</html>
</iframe>
</div>
</div>
</body>
</html>
Tables in HTML
- Tables are used to organize the data in rows and
columns.
- HTML uses tables to present content in rows and
columns.
- Early version of HTML [4] used tables for designing
entire document.
- HTML 5 introduced new elements and attributes
for designing tables.
- HTML 5 table elements are
Element Description
<table> It is a collection of rows and
columns.
<caption> It sets caption for table.
<thead> It defines the table header section.
<tbody> It defines the table body section.
<tfoot> It defines the table footer section.
<th> It defines column heading content.
<tr> It defines the table row.
<td> It defines the table cell content.
<colgroup> It groups a set of columns to define
effects.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Tables</title>
</head>
<body>
<table width="400" border="1">
<caption>Products Table</caption>
<colgroup span="2" style="background-
color: yellow;" ></colgroup>
<thead>
<tr>
<th>Product Id</th>
<th>Name</th>
<th>Price</th>
<th>Preview</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>JBL Speaker</td>
<td> ₹ 5600.55</td>
<td>
<img src="../Images/speaker.jpg"
width="50" height="50">
</td>
</tr>
<tr>
<td>2</td>
<td>Nike Casuals</td>
<td>₹ 3000.44</td>
<td>
<img src="../Images/shoe.jpg"
width="50" height="50">
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td>© copyright 2021</td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</body>
</html>
Syntax:
<table border=”1” frame=”void”>
<table border=”1” rules=”all”>
border will not be applied to table.
Syntax:
<table width="600" cellpadding="10" cellspacing="10"
border="1" frame="void">
Alignments
align It aligns the content horizontally left,
center, right or justify.
Syntax:
<table align=”center”>
<tbody align=”center”>
<tr align=”center”>
<td align=”center”>
valign It aligns the content vertically top, center,
bottom.
Syntax:
<tbody valign=”top”>
<tr valign=”bottom”>
<td valign=”center”>
Syntax:
<tbody align=”center” valign=”center”>
Height and width
Height It defines height for row.
Syntax:
<tr height=”200”>
<th height=”200”>
<td height=”200”>
Width It defines cell width.
<td width=”200”>
<th width=”200”>
Syntax:
<table width=”300” height=”100”>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Tables</title>
</head>
<body>
<table border="1" width="400">
<thead>
<tr>
<th rowspan="3">Head Section</th>
</tr>
<tr>
<th colspan="2">Name</th>
<th colspan="3">Address</th>
</tr>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>City</th>
<th>State</th>
<th>Postal Code</th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="5">Body Section</th>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="5" align="center">Table
Split</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
<tfoot>
<tr>
<th rowspan="2">Footer Section</th>
</tr>
<tr height="50">
<td align="center" colspan="5"><i>©
copyright 2021</i></td>
</tr>
</tfoot>
</table>
</body>
</html>
Syntax:
<table background="../Images/shoeanimated.gif"
border="1" width="500">
<table bgcolor=”red”>
<tr bgcolor=”red”>
Summary
Tags
- table
- thead
- tbody
- tfoot
- th
- tr
- td
- colgroup
- caption
Attributes
- frame
- border
- rules
- width
- height
- align
- valign
- bgcolor
- background
- cellspacing
- cellpadding
- colspan
- rowspan
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Products Catalog</title>
</head>
<body>
<table align="center" width="100%"
cellspacing="20" cellpadding="10" border="0">
<tr bgcolor="lightgreen">
<td colspan="2" align="center">
<h1>Amazon Shopping</h1>
</td>
</tr>
<tr>
<td width="200">
<img src="../Images/speaker.jpg"
width="200" height="200">
</td>
<td>
<table width="100%" height="100"
border="1">
<colgroup span="1" style="background-
color: yellow;"></colgroup>
<tr>
<td>Name</td>
<td>JBL Speaker</td>
</tr>
<tr>
<td>Price</td>
<td>4600.55</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="200">
<img src="../Images/shoe.jpg"
width="200" height="200">
</td>
<td>
<table width="100%" height="100"
border="1">
<colgroup span="1" style="background-
color: yellow;"></colgroup>
<tr>
<td>Name</td>
<td>Nike Casuals</td>
</tr>
<tr>
<td>Price</td>
<td>4600.55</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="200">
<img src="../Images/shirt.jpg" width="200"
height="200">
</td>
<td>
<table width="100%" height="100"
border="1">
<colgroup span="1" style="background-
color: yellow;"></colgroup>
<tr>
<td>Name</td>
<td>Shirt</td>
</tr>
<tr>
<td>Price</td>
<td>4600.55</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="lightgreen">
<td colspan="2" align="center">
<i>© copyright 2021</i>
</td>
</tr>
</table>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Table Layout</title>
<link rel="stylesheet" href="../fonts/css/all.css">
<style>
ul {
list-style: none;
}
ul > li {
font-size: 20px;
color:white;
margin-top: 10px;
}
ol {
list-style: none;
margin-left: -20px;
}
ol > li {
width: 150px;
border:2px solid black;
padding:13px;
margin-top: 25px;
font-size: 20px;
background-color: black;
color:white;
border-radius: 10px;
}
iframe {
border:none;
}
a{
color:white;
text-decoration: none;
}
</style>
</head>
<body>
<table frame="void" border="1" width="100%"
cellspacing="20" cellpadding="10">
<tr height="100">
<td colspan="3">
<img src="../Images/amazon-header.png"
width="100%">
</td>
</tr>
<tr height="400">
<td width="200">
<ol>
<li>
<a href="../Pages/home.html"
target="frameBody"> <span class="fa fa-
home"></span> Home</a>
</li>
<li>
<a href="../Pages/electronics.html"
target="frameBody"> <span class="fa fa-tv"></span>
Electronics</a>
</li>
<li>
<a href="../Pages/fashion.html"
target="frameBody"> <span class="fa fa-
tshirt"></span> Fashion</a>
</li>
<li>
<a href="../Pages/footwear.html"
target="frameBody"> <span class="fa fa-shoe-
prints"></span> Footwear</a>
</li>
</ol>
</td>
<td>
<iframe src="../Pages/home.html"
name="frameBody" width="100%"
height="400"></iframe>
</td>
<td width="160">
<img src="../Images/hpBanner.png"
height="400" width="160">
</td>
</tr>
<tr height="50">
<td bgcolor="black" colspan="3">
<table align="center">
<tr>
<td>
<ul>
<li>
<h2>Get to Know Us</h2>
</li>
<li>About Us</li>
<li>Press Release</li>
<li>Gift a smile</li>
</ul>
</td>
<td>
<ul>
<li>
<h2>Get to Know Us</h2>
</li>
<li>About Us</li>
<li>Press Release</li>
<li>Gift a smile</li>
</ul>
</td>
<td>
<ul>
<li>
<h2>Get to Know Us</h2>
</li>
<li>About Us</li>
<li>Press Release</li>
<li>Gift a smile</li>
</ul>
</td>
<td>
<ul>
<li>
<h2>Get to Know Us</h2>
</li>
<li>About Us</li>
<li>Press Release</li>
<li>Gift a smile</li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Task:
Forms in HTML
- Form provides an UI from where user can interact
with our application.
- Interaction includes insert, update, delete, query
etc.
- Form is a container with collection of elements like
button, textbox, checkbox, radio, list box etc.
- HTML form is created by using following elements
o <form>
o <input>
o <select>
o <option>
o <datalist>
o <textarea>
o <meter>
o <progress> etc.
Form Container
- Form container is defined by using <form> tag.
- A web page can contain multiple forms. Hence you
have to define a start and end tag.
Syntax:
<form>
</form>
- A page can submit the details only when they are
enclosed a form.
- You have to make sure that the form elements are
present inside <form> container.
Syntax:
Name : <input type=”text” name=”Name”> //
Not good
<form>
Name : <input type=”text” name=”Name”> // OK
</form>
- HTML form element provides following attributes
Attribute Description
Id It defines a unique ID for form.
name It defines a reference for form.
class It defines a CSS class for form.
method It indicates the request method for
form, which can be:
- GET
- POST
The default form method is GET
action It specifies the target where the
data is submitted. It refers to the
server-side page to submit form
data.
Ex: page.jsp, page.aspx, page.php,
page.asp
Syntax:
<form method=”post”
action=”page.aspx”>
target It can open the target page in a new
tab or in a frame.
Syntax:
<form method=”post”
action=”page.aspx”
target=”_blank”>
novalidate - HTML 5 introduced validations.
- Validation is the process of
verifying the user input and
restrict to specific type or range.
- Some of the validations
provided by HTML 5 are not
suitable for our requirements.
Hence we have to by-pass
[Ignore] the validations by using
“novalidate”.
Ex:
<form novalidate>
Email:
<input type=”email”
name=”Email”>
<button>Submit</button>
</form>
btnDelete, frmRegister
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Forms in HTML</title>
<style>
.form-login {
width: 300px;
height: 100px;
border:2px solid;
padding:20px;
}
</style>
</head>
<body>
<form id=”frmLogin” class=”form-login”
name=”frmLogin”>
</form>
</body>
</html>
GET vs POST
GET POST
GET method is used to POST method is used to
fetch [Access] data from submit data to server.
server. - If you are designing a
- If you are designing a form to submit the
form to get data client data to server,
from server and then use POST
display in page, then method.
use GET method.
If submit form data on Data will be in Form
GET request it will be Message Body
added into URL as Query
String.
Any one can view your It is not appended into
data. URL, it is not visible to
users.
It is not safe. It is safe
It is easy to hack data. It is hard to hack data.
It allows to bookmark the It can’t be bookmarked.
data.
It is stored in browser It is not stored in browser
logs. [history] history.
You can’t submit It can submit complex
complex data, like binary data.
data. It allows only ASCII
type.
You can submit limited There is no limit for
data. Query string allows submitting data.
2048 chars.
The data can be cached. Data can’t be cached.
It will store data in cache
and saves round trip.
Attribute Description
Id It defines a unique ID
name It defines a reference name.
class It specifies the classes to implement.
value It specifies the default value to
display in side textbox.
Syntax:
<input type="text" value="David"
name="txtName">
placeholder It defines the water mark text for
input element. The water mark can’t
display if there is a value defined.
autofocus It can set focus to the text box
automatically on page load. Only one
element in “Form” can be set with
autofocus.
Syntax:
<input type="text" placeholder="Last
Name" autofocus>
readonly It will not allow to change value.
It will not allow to input value.
If you want to display a value but
should not allow to modify the value,
then you can mark it as readonly.
Syntax:
<input type="text" readonly
name="txtId" value="101">
disabled It will not allow to input or change
value.
It will not submit value.
Syntax:
<input type="text" disabled
name="txtId" value="101">
Disabled vs Readonly
- Readonly can submit the value
- Can’t submit the value
required - It will not allow to submit empty.
- It is used for mandatory fields.
- If textbox is not defined with
value, then it will not allow to
submit the form.
- However if form is defined with
“novalidate” then you can
submit empty.
Syntax:
<input type="text" name="txtId"
required>
minlength It ensures that the input value
minimum length matches the lower
bound value.
maxlength It restricts the input value to
specified maximum number of chars.
Syntax:
<input name="txtName" type="text"
required minlength="4"
maxlength="10">
size It is used to define the width of
textbox. The default width is 20.
Syntax:
<input type="text" size="2"
name="txtPin" maxlength="10">
list - It uses a data list that contains
options to display as
autocomplete text.
- Data list is designed by using
<datalist> element
- Data list contains a set of options
defined by using <option>
element.
pattern - It is used to verify the format of
input value and restrict the value
to specific format.
- Pattern uses “Regular
Expression” to verify the input
value.
- Regular Expression is built by
using meta character and
quantifiers.
Ex:
<input pattern="colou*r" type="text"
name="txtTest">
[color, colour, colouur, coloruuur
etc..]
+ It defines one or more occurrences of
a character.
Ex:
<input pattern="colou+r" type="text"
name="txtTest">
[colour, colouur…]
. [dot] Matches any single character in the
specified string.
Ex:
<input pattern="b.y" type="text"
name="txtTest"> [buy, boy]
Ex:
<input pattern=".y" type="text"
name="txtTest"> [by, my]
Ex: cow, toy, boy [ pattern=”.o.” ]
Ex:
<input pattern="\d\d" type="text"
name="txtTest"> [any 2 digits
number]
Ex:
<input pattern="\d?\d" type="text"
name="txtTest"> [one or 2 digits]
Ex:
<input pattern="[0-9]" type="text"
name="txtTest">
\D Not a digit [^0-9] or \D only non-digit.
Ex:
<input pattern="\D\D" type="text"
name="txtTest">
\w Matches alpha numeric characters
with underscore.
Equivalent to [A-Za-z0-9_]
Ex:
<input pattern="\w\w" type="text"
name="txtTest">
\W Matches any character that is not a
word character.
[^A-Za-z0-9_]
Ex:
<input pattern="\W" type="text"
name="txtTest">
[%$#@&]
^ Exclude specified
\s Match a single white space character.
Including space, tab, form feed, line
feed, and other Unicode chars.
\n – line feed
\f – form feed
\t – horizontal tab
\v – vertical tab
Ex:
<input pattern="\w\s\w" type="text"
name="txtTest">
left|right The “|” is used as OR. We can
configure multiple by using OR. It can
match with any of the specified.
Ex:
<input pattern="green|red|blue"
type="text" name="txtTest">
[A-Z] Only uppercase letters allowed
[a-z] Only lowercase letters allowed
[0-9] Only numeric allowed.
[a-zA-Z] Both upper and lowercase allowed.
[a-Z] Both upper and lowercase allowed.
[a-zA-Z0-9] Alpha numeric allowed
[a,d,s] Only specified chars allowed.
[^a,d,s] Excluding the specified all others
allowed.
[a-mA-M4-9] Only chars in specified range allowed.
[^a-mA-M4- Excluding specified chars range all
9] others allowed.
(abc) Exactly the specified group allowed in
specified order.
$ Matches the end of input. “Ends with”.
\^ Matches the beginning of input.
“Starts with”.
(?=.*[A-Z])\w{4,15}
Ex:
<input pattern="(?=.*[A-Z])\w{4,15}" type="text"
name="txtTest">
Number Input:
- HTML can use input type as “number”.
- It allows only numeric values.
- All basic attributes are similar to text input.
- Instead of max length and min length number uses
“Min and Max”.
- Min: specifies the minimum range of value.
- Max: specifies the maximum range of value.
- Step: specifies the increment and decrement step
value. [By default it is 1]
Syntax:
<input type="number" min="15" max="35" step="5"
value="17" name="txtAge">
<input type="number" min="1.5" max="5.5"
step="0.1" value="1.5" name="txtAge">
Date Input:
- HTML allows to input date value by using the
“type=date”.
- It is not supported on all browsers. hence we have
to implement using jQuery.
o date
o datetime-local
o month
o week
Syntax:
<input type="date" min="2021-01-28" max="2021-03-
20" name="txtDob">
<input type="date" min="2021-01-28" value="2021-01-
29" max="2021-03-20" name="txtDob">
Range Input:
- It will display a slider that allows to select a range
of values.
- Its attributes are similar to number.
- Slider value you can show using JavaScript.
- Slide value can be submitted but can’t display on
page in every browser.
Password Input:
- It is similar to text in all attributes.
- It will mask the text with password char “*”
- You can configure by using “type=password”
Syntax:
<input required pattern="[A-Z]{4,10}" type="password"
name="txtPwd">
URL Input:
- It validates URL format.
- If you want the user to input website address
[URL] and restrict to URL format the you can
define “type=url”
Syntax:
<input type="url" name="txtUrl">
Email Input:
- It validates email address format.
- You can define “type=email”
Syntax:
<input type="email" name="txtEmail">
Color Input:
- HTML provides a color picker by using
“type=color”.
- It allows to select a color for color panel.
- The color code/name is submitted.
Syntax:
<input type="color" name="txtColor">
File Input:
- It allows the client to browse and select any file
from computer to upload into server.
- However it is just a control for selecting file,
upload logic we have to write by using
“JavaScript/JQuery”.
- You can define by using “type=file”.
- You can use “multiple” attribute to enable
selection for multiple files.
Syntax
<input type="file" multiple name="txtPhoto">
- You can configure specific type dynamically using
MIME type or you can also use attribute “accept”
for filtering the file type.
Syntax:
<input type="file" accept=".jpg" multiple
name="txtPhoto">
Radio Buttons:
- Radio buttons are used to exhibit “Mutex” [Mutual
Exclusion] mechanism.
- Radio buttons allow to select one or multiple.
- Once radio button is checked, it can’t be
unchecked.
- To uncheck the radio button, you have to reload
the page or configure “Mutex”
- “Mutex” is a multi-threading mechanism that
loads all tasks into memory but allow only one task
in process.
- To configure mutex all radios must run on same
thread, which you can define by using “common
name”.
- “Checked” attribute is used to select radio.
- By default, radio submits “ON” as value.
- You can define a value to submit.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Regular Expression</title>
</head>
<body>
<form>
<div>
<label>Upload Photo</label>
<div>
<input type="radio" value="Male"
name="gender" checked> Male
<input type="radio" value="Female"
name="gender"> Female
<button>Submit</button>
</div>
</div>
</form>
</body>
</html>
CheckBox
- Checkbox allows user to select and deselect any
option.
- You can use checkbox for selecting one or multiple
options from a group of choices.
- The attributes are same as radio buttons
o Id
o Name
o Class
o Value
o Checked etc.
- It is defined by using input attribute
“type=checkbox”.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Regular Expression</title>
</head>
<body>
<form>
<div>
<label>Select Courses</label>
<div>
<input type="checkbox" name="course"
value="Java" checked> Java
<input type="checkbox" name="course"
value=".NET"> .NET
<button>Submit</button>
</div>
</div>
</form>
</body>
</html>
Ex: Apply effects checkbox checked property with CSS
<!DOCTYPE html>
<html>
<head>
<title>CheckBox</title>
<style>
.container {
width: 500px;
height: 200px;
padding:5px;
background-color: lightgray;
}
.terms+span {
color:red;
}
.terms:checked+span {
color:green;
}
</style>
</head>
<body>
<form>
<div>
<label>Terms of Service</label>
<div>
<div class="container">
<p>Depending on how you obtained the
Windows software, this is a license agreement
between (i) you and the device manufacturer or
software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or,
based on where you live or, if a business, where your
principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices
produced by Microsoft or one of its affiliates, and
Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume
license customer, use of this software is subject to your
volume license agreement rather than this
agreement.</p>
</div>
<div>
<input class="terms" type="checkbox">
<span>I Accept</span>
</div>
</div>
</div>
</form>
</body>
</html>
FAQ: How to design a checkbox list?
- HTML is not provided with checkbox list control,
you have to design with CSS overflow technique.
<!DOCTYPE html>
<html>
<head>
<title>Checkbox list</title>
<style>
ul {
list-style: none;
margin-left: -40px;
}
.container {
border: 2px solid;
width: 120px;
height: 60px;
overflow:auto;
}
</style>
</head>
<body>
<h2>Select Courses</h2>
<div class="container">
<ul>
<li> <input type="checkbox"> Java </li>
<li> <input type="checkbox"> .NET </li>
<li> <input type="checkbox"> PHP </li>
<li> <input type="checkbox"> UI </li>
<li> <input type="checkbox"> Fullstack </li>
<li> <input type="checkbox"> Oracle </li>
</ul>
</div>
</body>
</html>
Dropdown list:
- It allows the user to select any one option from a
group of choices.
- It shows the list of items using a dropdown menu.
- HTML provides the following elements for
designing dropdown list:
ListBox
- It everything same as dropdown list in elements
and attribute.
- It allows to select one or multiple.
- To change the dropdown into listbox you have use
the attribute “size or multiple”
Syntax:
<select size=”3” multiple>
</select>
<!DOCTYPE html>
<html>
<head>
<title>Dropdown</title>
</head>
<body>
<h3>Select a Product</h3>
<form>
<select size="3" multiple name="lstProducts">
<optgroup label="Electronics" >
<option>Samsung TV</option>
<option>LG Mobile</option>
</optgroup>
<optgroup label="Footwear">
<option>Nike Casuals</option>
<option>Lee Boot</option>
</optgroup>
</select>
<button>Submit</button>
</form>
</body>
</html>
Textarea
- It is used to handle multiline input.
- It is similar to textbox but allows multiple lines.
- It is RC data element used to present plain text.
- Attributes are similar to text input, additionally
uses
o Rows
o Cols
Syntax:
<textarea rows=”4” cols=”40>
Your text… / optional
</textarea>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Text Area</title>
<style>
dt {
font-weight: bold;
}
</style>
</head>
<body>
<dl>
<dt>User Name</dt>
<dd><input type="text"></dd>
<dt>Address</dt>
<dd>
<textarea disabled rows="4" cols="40">
<b>Your Address.. here..</b>
</textarea>
</dd>
<dt>Comments</dt>
<dd>
<textarea rows="4" cols="40">
</textarea>
</dd>
</dl>
</body>
</html>
Meter Element
- It is used to display the grade meter.
- It can display a value range with
o min
o max
o value
o low
o high
Syntax:
<meter min=”” max=”” value=”” low=”” high=”” id=””
class=”” name=””>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Meter</title>
<style>
meter {
width: 300px;
height: 40px;
}
</style>
</head>
<body>
<fieldset>
<legend>Meter</legend>
<dl>
<dt>Normal Style</dt>
<dd>
<meter></meter>
</dd>
<dt>Meter 40%</dt>
<dd>
<meter min="1" max="100" value="40">
</meter>
</dd>
<dt>Meter 100%</dt>
<dd>
<meter min="1" max="100" value="100">
</meter>
</dd>
<dt>Meter Poor</dt>
<dd>
<meter min="1" max="100" value="100"
low="60" high="80">
</meter>
</dd>
<dt>Meter Weak</dt>
<dd>
<meter min="1" max="100" value="100"
low="20" high="80"></meter>
</dd>
</dl>
</fieldset>
</body>
</html>
Progress Element:
- It is used to show the status of any task performed
in the page.
- The task includes actions like
o Copying
o Downloading
o Uploading
o Connecting etc.
- It is used to display the time elapsed or the
remaining to complete the task.
- Specially progress is used in pages that use “Ajax”
[Asynchronous JavaScript And XML]
- Attributes used for progress
o Min
o Max
o Value
Syntax:
<progress min=”” max=”” value=”” name=””>
</progress>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Progress</title>
</head>
<body>
<dl>
<dt>Preparing for Download</dt>
<dd>
<progress></progress>
</dd>
<dt>80% Downloaded</dt>
<dd>
<progress min="1" value="80"
max="100"></progress>
</dd>
<dt>Download Completed</dt>
<dd>
<progress min="1" max="100"
value="100"></progress>
</dd>
</dl>
</body>
</html>
Form Output Element:
- It is a container element into which application can
inject the result of a calculation or the outcome of
user input.
- It is defined by using <output> tag.
- It requires a form event “oninput”
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Output Element</title>
</head>
<body>
<form
oninput="total.value=qty.value*price.value">
<dl>
<dt>Name</dt>
<dd><input type="text"></dd>
<dt>Quantity</dt>
<dd>
<input type="number" id="qty" name="qty"
value="1">
</dd>
<dt>Price</dt>
<dd>
<input type="text" id="price"
name="price">
</dd>
<dt>Total</dt>
<dd>
<output name="total" for="qty price"
></output>
</dd>
</dl>
</form>
</body>
</html>
Buttons:
- Buttons are used to confirm user actions.
o Record Actions
Insert, Update, Delete, Edit
o Record Navigation
Next, Previous, First, Last
o Miscellaneous Actions
Submit, Register, Login, Reset, Save,
Open, Print, Cancel etc.
- HTML 5 provides “button” element for designing
button.
- Buttons in HTML are classified into 2 groups
o Generic Buttons
o Non-Generic Buttons
- Generic Buttons have pre-defined functionality
o Submit: Have the ability to submit “form”.
<input type=”submit”>
<button type=”submit”> Text </button>
<button> Text </button>
o Reset: Have the ability to reset the form.
<input type=”reset”>
<button type=”reset”> Text </button>
Note: HTML <button> Allows images and symbols.
HTML <input type=”submit”> Will not allow
symbols or images.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Button</title>
<link rel="stylesheet" href="/fonts/css/all.css">
</head>
<body>
<form>
<dl>
<dt>Name</dt>
<dd><input type="text" value="TV"
name="txtName"></dd>
<dt>Price</dt>
<dd><input type="text"
name="txtPrice"></dd>
<dt>Stock</dt>
<dd><input type="checkbox"> Available</dd>
</dl>
<button>
<span class="fa fa-user"></span> Login
</button>
<button type="reset">
<img src="/Images/cancel.png" width="40"
height="20">
</button>
</form>
</body>
</html>
- Non-Generic Button: It is a simple button without
any pre-defined functionality.
<input type=”button”>
<button type=”button”>
Ex:
<button type="button">
<span class="fa fa-print"></span> Print
</button>
<input type="button" value="Save">
Marquee:
- It is used to display sliding and scrolling content in
page.
- <marquee> is a container that can contain scrolling
and sliding content.
Syntax:
<marquee>
Your content
</marquee>
- You can use the following attributes to handle
marquee
Attribute Description
Scrollamount Control the marquee scrolling
speed [1 to 100].
Syntax:
<marquee scrollamount="15">
Flash.. Flash.. 70% OFF on
electornics.
</marquee>
direction It specifies the scrolling
directions, which can be left,
right, up or down.
Syntax:
<marquee direction=”up”>
</marquee>
Width and Sets the width and height for
Height marquee content.
Syntax:
<marquee width=”100”
height=”300”>
</marquee>
behavior It changes the marquee
behaviour from scrolling to
sliding. It can be defined as
“alternate, scroll and slide”.
Ex:
<marquee behavior="alternate"
scrollamount="15">
Flash.. Flash.. 70% OFF on
electornics.
</marquee>
Loop It specifies the number of time
marquee content need to display.
Ex:
<marquee loop="3"
scrollamount="15">
Flash.. Flash.. 70% OFF on
electornics.
</marquee>
Scrolldelay It delays the start of marquee.
<marquee scrolldelay=”100”>
</marquee>
Bgcolor It sets background color for
marquee area.
Syntax:
<marquee bgcolor=”yellow”>
</marquee>
</style>
</head>
<body>
<div>
<marquee scrolldelay="10">
Flash.. Flash.. 70% OFF on electornics.
</marquee>
<marquee scrolldelay="25">
Flash.. Flash.. 70% OFF on electornics.
</marquee>
<marquee scrolldelay="50">
Flash.. Flash.. 70% OFF on electornics.
</marquee>
<marquee scrolldelay="100">
Flash.. Flash.. 70% OFF on electornics.
</marquee>
<marquee scrolldelay="300">
Flash.. Flash.. 70% OFF on electornics.
</marquee>
</div>
<div>
<marquee onmouseout="this.start()"
onmouseover="this.stop()" bgcolor="yellow"
width="100" scrollamount="10" direction="up">
<div>
<img src="../Images/speaker.jpg"
width="100" height="100">
</div>
<div>
<img src="../Images/shoe.jpg" width="100"
height="100">
</div>
<div>
<img src="../Images/shoe1.jpg"
width="100" height="100">
</div>
<div>
<img src="../Images/earpods.jpg"
width="100" height="100">
</div>
<div>
<img src="../Images/shirt.jpg" width="100"
height="100">
</div>
</marquee>
</div>
</body>
</html>
Embed Audio and Video Content
- HTML can use “<embed>” element to embed any
multi media content into page.
- HTML 5 introduces <video> and <audio> elements
for embedding multi media.
Video Element:
- HTML Video Element <video> embeds a media
player into web page.
- The media player will support video playback in
document.
- You can embed “audio” content with <video> tag.
But recommended to use <audio> tag for audio
content, as it provides better attributes for audio.
- The commonly used attributes for “<video>”
element
Attribute Description
autoplay It uses “boolean” value
[true/false]. It enables auto play
when set to true.
controls It is used to define controls for
media player. Controls can be like
seekbar, and play/resume etc.
crossorign It indicates whether to use CORS.
Height To define width and height of
/width media player.
Loop It uses a boolean value, which
allows to loop the video
continuously.
Muted It uses boolean value to mute the
video on loading.
Poster It is used as thumbnail for video
before playback.
Src It defines the name and location of
video content.
Syntax:
<video muted src=”” poster=””>
Message – Is displayed when browser is unable
to use video element.
</video>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Video</title>
</head>
<body>
<h2>Video Element</h2>
<video controls width="300" height="200"
src="../docs/class.mp4">
<p>Video is not supported on your browser</p>
</video>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Video</title>
</head>
<body>
<h2>Video Element</h2>
<video poster="../Images/amazon.PNG"
width="300" height="200">
<source src="../docs/class.mp4" >
<p>Video is not supported on your browser</p>
</video>
<h2>Video Embed</h2>
<embed src="../docs/class.mp4" >
</body>
</html>
Note: Audio element is also similar to video. [mp3,
MIDI]
Syntax:
<audio controls>
<source src=”music.mp3”>
</audio>
Poster can’t be defined for audio on various browsers.
CSS Colors
- Colors in CSS can be defined by using 3
techniques
o Color Name
o Hexadecimal color code
o RGB Color methods
Color Names
- CSS supports 16 million colors.
- Standard color names are few.
- You can directly define the color name or
color shade name.
Syntax:
h2{
color:green;
}
h2{
color:lightgreen;
}
Hexadecimal color code
- The primary colors are “Red, Green & Blue”.
- All colors are derived from primary colors.
- Hexadecimal allows to define multiple color
shades.
- Hexadecimal colors have a combination or 3
or 6 chars with prefix “#”
- Hexadecimal number system is 16 base
number system.
- We use 16 different values to mix and create
a color shade.
- Hexadecimal color code uses the values
0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
- 0 is minimum and f is maximum.
- Color code have 3 or 6 places other than #
- If it is 3 then “#RGB”
R - Red value
G - Green value
B - Blue value
- Red, Green and Blue will have 1 place
representation
Syntax:
<style>
input {
background-color: #af0;
}
</style>
- If it is 6 places then “#RRGGBB”.
- Red, green and blue values will have 2 places.
Syntax:
<style>
input {
background-color: #dddddd;
}
</style>
RGB color code
- The colors are defined with “Red, Green and
Blue” combination.
- The method “rgb()” is used for RGB colors.
- It takes 3 values “rgb(redValue, greenValue,
blueValue)”
- The value range for red, green and blue will
be between 0 to 255.
Syntax:
rgb(0,0,255) blue color
rgb(255,0,0) Red color
Ex:
<style>
input {
background-color:rgb(205,123,215);
}
</style>
RGBA (Red, Green, Blue, Alpha)
- Alpha is for opaque 1.0 is full opaque
- Range between 0.0 to 1.0
<style>
input {
background-color:rgba(255, 0, 0, 0.3);
}
</style>
CSS Units
- Units define size and position.
- You can configure size with: height and width
- You can configure position with: x-axis, y-axis
and z-axis
- The CSS units are categorized into 2 groups
o Absolute Length Units
o Relative Length Units
Absolute Length Units
- They are not relative to anything else and are
generally considered as normal units.
- These are not affected by other relative
elements and their units.
Unit Name Equivalent to
cm Centimetres 1cm = 96px/2.54 =
37px
mm Millimetres 1mm = 1/10th of 1
cm
Q Quarter 1Q = 1/40th of 1 cm
Millimetres
in Inches 1in = 2.54cm =
96px
pc Picas 1pc = 1/6th of 1in
pt Point 1pt = 1/72th of 1in
Px Pixels 1px = 1/96th of 1in
Relative length units:
- These are related to other contents in the
page.
- The size of any element can be determined
based on its parent, child or adjacent.
- The advantages are when parent element size
is changed will relatively affects the child
element also.
Unit Relative To
em It uses the font size of parent
element and applies to current
element.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Negation</title>
<style>
body {
font-size: 20px;
}
.effects {
font-size: 2em;
}
</style>
</head>
<body>
Amazon
<ul class="effects">
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
</ul>
</body>
</html>
ex X- height of elements’ font [width]
ch Defined for width, with regard to
the root element.
rem Font size to the root element size.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Negation</title>
<style>
body {
font-size: 20px;
}
.effects {
font-size: 2em;
}
.effectsInner {
font-size: 1rem;
}
</style>
</head>
<body>
Amazon
<ul class="effects">
<li>Item-1
<ol class="effectsInner">
<li>child-1</li>
<li>child-2</li>
</ol>
</li>
<li>Item-2</li>
<li>Item-3</li>
</ul>
</body>
</html>
ln Line height of the element.
vw 1% of the viewport’s width.
vh 1% of the viewport’s height.
vmin 1% of the viewport’s smaller
dimension.
vmax 1% of the viewport’s larger
dimension.
Cascading Rules
- If a set of effects are re-defined for same
element with same type of selector then
according to CSS rule the last set of effects
are applied to element.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Negation</title>
<style>
h2 {
color:red;
}
h2 {
color:blue;
}
</style>
</head>
<body>
<h2>Amazon Shopping</h2> // color -
blue
</body>
</html>
- If element have to choose between type
selector and class selector then it will always
choose the “class selector”.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Negation</title>
<style>
.heading {
color:blue;
}
h2 {
color:red;
}
</style>
</head>
<body>
<h2 class="heading">Amazon
Shopping</h2>
</body>
</html>
- If element is configured with both ID and
class selector then always ID selector related
effects are applied to element.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Negation</title>
<style>
.heading {
color:blue;
}
h2 {
color:red;
}
#effects {
color:green;
}
</style>
</head>
<body>
<h2 id="effects" class="heading" >Amazon
Shopping</h2>
</body>
</html>
- If different style attributes are defined in ID,
Class and Type selectors and applied to any
specific element. Then then all styles are
applied to element. Only same name style
attributes are overridden.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Negation</title>
<style>
.heading {
color:blue;
text-align: center;
}
h2 {
color:red;
border:2px solid red;
}
#effects {
color:green;
box-shadow: 2px 3px 3px red;
}
</style>
</head>
<body>
<h2 id="effects" class="heading" >Amazon
Shopping</h2>
</body>
</html>
1st priority is for ID
2nd is for Class
3rd is for Type
CSS 2D Transforms
- CSS 2D Transform feature allows the element
to be transformed in 2-Dimensional space.
- 2D is along X-Axis and Y-Axis
- CSS provides “transform” property to defined
transformations.
- CSS transforms are not supported on various
browsers.
- You have to use special plug-in for different
browsers.
Browser Plugin
Chrome, Safari, -webkit
Opera
Firefox -moz
Internet Explorer 9 -ms
Syntax:
transform: someMethod(); //standard
-webkit-transform: someMethod();
-moz-transform:someMethod();
-ms-transform:someMethod()
-o-transform:someMethod()
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Translate</title>
<style>
img{
margin-left: 10px;
transition: 2s;
}
img:hover{
transform: translate(500px,200px);
-webkit-transform: translate(500px,
200px);
-moz-transform: translate(500px, 200px);
-ms-transform: translate(500px, 200px);
transition: 2s;
}
</style>
</head>
<body>
<img src="../Images/shoe.jpg" width="100"
height="100">
</body>
</html>
scale()
- It is used to increase or decrease the size of
element along x and y axis.
- You can control the height and width of
element.
Syntax:
transform:scale(scaleX, scaleY);
transform:scaleX()
transform:scaleY()
- Scale units are defined in fractions
o 1 = 100
o 1.5 = 150
o 2 = 200
Syntax:
transform:scale(2) // both x and y will be 200
transform:scale(2,1) // x will be 200 and y 100
transform:scaleX(2) // x will be 200
X = width
Y = height
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Translate</title>
<style>
img{
margin-left: 10px;
transition: 2s;
}
img:hover{
transform: scale(3) ;
transition: 2s;
}
.container div {
align-items: center;
justify-content: center;
margin: auto;
width: 300px;
margin-top: 200px;
}
</style>
</head>
<body>
<div class="container">
<div>
<img src="../Images/shoe.jpg"
width="100" height="100">
</div>
</div>
</body>
</html>
Skew()
- Skew is used to tilt the image by specified
angle.
Syntax:
transform:skew(sx, sy)
transform:skewX(angle)
transform:skewY(angle)
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Translate</title>
<style>
img{
margin-left: 10px;
transition: 2s;
height: 300px;
width: 300px;
}
img:hover{
transform: skew(-20deg) ;
transition: 2s;
}
.container div {
align-items: center;
justify-content: center;
margin: auto;
width: 300px;
margin-top: 200px;
}
</style>
</head>
<body>
<div class="container">
<div>
<img src="../Images/shoe.jpg"
width="100" height="100">
</div>
</div>
</body>
</html>
Rotate()
- It rotates the element around its origin.
- It uses value defined in deg.
- It uses 0 to 360 deg angle
- You can use -ve value for counter clockwise.
Syntax:
transform:rotate(‘angle’);
transform:rotateX()
transform:rotateY()
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Translate</title>
<style>
img{
margin-left: 10px;
transition: 2s;
height: 300px;
width: 300px;
}
img:hover{
transform: rotate(-180deg) ;
transition: 2s;
}
.container div {
align-items: center;
justify-content: center;
margin: auto;
width: 300px;
margin-top: 200px;
}
</style>
</head>
<body>
<div class="container">
<div>
<img src="../Images/shoe.jpg"
width="100" height="100">
</div>
</div>
</body>
</html>
Transform Matrix
- Matrix allows to define all 2D transforms to
single element.
- The transform methods
o translate(x,y)
o translateX()
o translateY()
o scale(x,y)
o scaleX()
o scaleY()
o rotate()
o rotateX()
o rotateY()
o skew()
o skewX()
o skewY()
Syntax:
matrix(scaleX(), skewY(), skewX(), scaleY(),
translateX(), translateY())
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Translate</title>
<style>
img{
margin-left: 10px;
transition: 2s;
}
img:hover{
transition: 2s;
transform: matrix(1.5,20,0.5,0,0,0);
}
</style>
</head>
<body>
<div class="container">
<div>
<img src="../Images/shoe.jpg"
width="100" height="100">
</div>
</div>
</body>
</html>
CSS 3D Transforms
- CSS 3D transforms allows 3-Dimensional
design.
- It will have configuration for X, Y and Z axis.
- The methods used for 3D are same as 2D but
comprises of 3rd Dimension.
Translate3d()
- It sets the position of element along x, y and z
axis.
Syntax:
translate3d(tx, ty, tz)
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Translate</title>
<style>
.container {
width: 100px;
height: 100px;
border:5px solid darkcyan;
background-image:
url("../Images/jblspeaker.jpg");
background-size: 100px 100px;
background-repeat: no-repeat;
margin:20px;
}
img {
width: 100px;
height: 100px;
border:1px dotted darkcyan;
opacity: 0.8;
box-shadow: -25px -25px 3px
darkcyan;
}
.transform-effect{
transform: translate3d(0px, 0px, 0px);
transition: 2s;
}
.transform-effect:hover {
transform: translate3d(25px, 25px,
100px);
transition: 2s;
}
</style>
</head>
<body>
<div class="container">
<img class="transform-effect"
src="../Images/jblspeaker.jpg">
</div>
</body>
</html>
Scale3d
- It changes the image size in 3 dimensions.
Syntax:
scale3d(x, y, z)
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Translate</title>
<style>
.container {
width: 200px;
height: 100px;
border:5px solid darkcyan;
background-color: darkgray;
margin:20px;
}
img {
width: 100px;
height: 100px;
border:1px dotted darkcyan;
opacity: 0.8;
}
.transform-effect{
transform: scale3d(1,1,1);
transition: 2s;
}
.transform-effect:hover {
transform: scale3d(1.5,1.5,1.5);
transition: 2s;
}
</style>
</head>
<body>
<div class="container">
<marquee onmouseover="this.stop()"
onmouseout="this.start()"
scrollamount="10">
<img class="transform-effect"
src="../Images/jblspeaker.jpg">
<img class="transform-effect"
src="../Images/shoe.jpg">
<img class="transform-effect"
src="../Images/shirt.jpg">
<img class="transform-effect"
src="../Images/earpods.jpg">
</marquee>
</div>
</body>
</html>
CSS Transition
CSS Text Styling
- Font Styling
It provides a set of attributes and values that are used to
format the text.
Attribute Description
color Defines the foreground color.
font-family It defines the font family name like:
Arial
font-size It defines the text size.
font-weight Defines normal, bold, lighter,
bolder.
font-style Defines italic effect.
text-transform Defines uppercase, lowercase,
capitalize, full-width. [affects the
font size]
text-decoration Defines underline, overline, line-
through.
It is short had for various text
decoration options like style of line,
color of line etc.
- text-decoration-color
- text-decoration-style
- text-decoration-line
text-shadow It defines a shadow for text.
text-align Left, center, right and justify
line-height Space between lines.
letter-spacing Space between letters.
word-spacing Space between words.
font-variant Caps, lowercase. [Without effecting
the height of text it will change to
caps]
text-indent First line spacing.
text-overflow Control the wrapping of text.
white-space Control the blank space.
direction Text direction
text-orientation Changes the orientation of text.
Text Shadow
- It defines shadow for text.
- Text shadow includes the following options to define
o Horizontal Offset [left to right]
o Vertical offset [front to back]
o Blur radius
o Color
Syntax:
text-shadow: hOffset vOffset blurRadius color;
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Text Effects</title>
<style>
div{
font-size: 50px;
text-transform: uppercase;
font-weight: bold;
text-shadow: 2px 3px 2px red;
}
</style>
</head>
<body>
<div>sample text</div>
</body>
</html>
Line, character, word spacing
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Text Effects</title>
<style>
div{
text-align: justify;
line-height: 45px;
text-indent: 100px;
word-spacing: 20px;
letter-spacing: 5px;
}
</style>
</head>
<body>
<div>Depending on how you obtained the Windows
software, this is a license agreement between (i) you and the
device manufacturer or software installer that distributes the
software with your device; or (ii) you and Microsoft
Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its
affiliates) if you acquired the software from a retailer.
Microsoft is the device manufacturer for devices produced by
Microsoft or one of its affiliates, and Microsoft is the retailer
if you acquired the software directly from Microsoft. Note
that if you are a volume license customer, use of this
software is subject to your volume license agreement rather
than this agreement.
</div>
</body>
</html>
Ex: Text Transform and Font variant
<!DOCTYPE html>
<html>
<head>
<title>Text Effects</title>
<style>
#p1 {
text-transform: uppercase;
}
#p2 {
font-variant: small-caps;
}
</style>
</head>
<body>
<div id="p1">Welcome to CSS</div>
<div id="p2">Welcome to CSS</div>
</body>
</html>
Ex: Text Overflow
<!DOCTYPE html>
<html>
<head>
<title>Text Effects</title>
<style>
#p1 {
width: 80px;
border:2px solid;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div title="Welcome to CSS" id="p1">Welcome to
CSS</div>
<img src="../Images/shoe.jpg" width="100" height="100"
title="sale on: www.amazon.in">
</body>
</html>
CSS Box Model
- Everything in CSS has a box around it.
- Understanding boxes is important for designing layout.
- It is often called as “Box Model”.
- Box model comprises of
Content Box The area where your content is displayed. It can be
defined by using “height and width” attributes.
Padding Box The padding is around the content as white space. Its
size can be controlled by using “padding”.
Border Box The border box warps around the content or
padding. It is controlled by using “border” property.
Margin Box The margin is the outmost layer wrapping the
content, padding and border. It configures a white
space around border. It is defined by using “margin”
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: gray;
}
.box {
background-color: white;
padding: 50px;
text-align: justify;
border:4px solid;
margin: 50px;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
Depending on how you obtained the Windows software, this is a
license agreement between (i) you and the device manufacturer or
software installer that distributes the software with your device; or (ii)
you and Microsoft Corporation (or, based on where you live or, if a
business, where your principal place of business is located, one of its
affiliates) if you acquired the software from a retailer. Microsoft is the
device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume license customer,
use of this software is subject to your volume license agreement rather
than this agreement.
</div>
</div>
</body>
</html>
Set Margins, Padding and Border
Margin
- It specifies the space around border.
- You define by using following properties
o margin [short hand – sets in all directions]
o margin-top
o margin-bottom
o margin-left
o margin-right
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: gray;
}
.box {
background-color: white;
padding: 50px;
text-align: justify;
border:4px solid;
margin-left: 40px;
margin-top: 20px;
margin-right: 30px;
margin-bottom: 60px;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
Depending on how you obtained the Windows software, this is a license
agreement between (i) you and the device manufacturer or software installer
that distributes the software with your device; or (ii) you and Microsoft
Corporation (or, based on where you live or, if a business, where your principal
place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by
Microsoft or one of its affiliates, and Microsoft is the retailer if you acquired
the software directly from Microsoft. Note that if you are a volume license
customer, use of this software is subject to your volume license agreement
rather than this agreement.
</div>
<div class="box">
Depending on how you obtained the Windows software, this is a license
agreement between (i) you and the device manufacturer or software installer
that distributes the software with your device; or (ii) you and Microsoft
Corporation (or, based on where you live or, if a business, where your principal
place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by
Microsoft or one of its affiliates, and Microsoft is the retailer if you acquired
the software directly from Microsoft. Note that if you are a volume license
customer, use of this software is subject to your volume license agreement
rather than this agreement.
</div>
</div>
</body>
</html>
Padding
- It specifies the space around content
- You can define
o Padding-left
o Padding-right
o Padding-top
o Padding-bottom
o Padding
- All options are similar like margin
CSS Transition
- CSS transition is a module of CSS.
- Transition is used for configuring animation
for initial and final state.
- Initial state is before transformation.
- Final State is after transformation.
- You can control the behaviour using various
CSS effects
o timing
o duration
o other attributes
- CSS Transition comprises of following
properties
o transition
o transition-delay
o transition-duration
o transition-property
o transition-timing-function
</div>
</body>
</html>
Ex: CSS Timing functions
<!DOCTYPE html>
<html>
<head>
<title>Timing</title>
<style>
div{
width: 100px;
height: 100px;
transition-duration: 2s;
background-color: red;
}
div:hover {
width: 1000px;
}
#easein {
transition-timing-function: step-start;
transition-timing-function: steps(10);
}
</style>
</head>
<body>
<div id="easein">
Hello ! Welcome to CSS Effects and
Animations
</div>
</body>
</html>
CSS Animations
- CSS animations are used to animate CSS
transitions.
- You can reduce the use of JavaScript and Flash
for animation.
- Animation can easily run on low bandwidth
devices like mobiles, tabs.
- Animation will work even when JavaScript is
disabled or flash plugin is not available.
- To create CSS animation, we need
o @keyframes
o animation
o animation-name
o animation-duration
o animation-timing-function
o animation-delay
o animation-iteration-count
o animation-direction
o animation-fill-mode
o animation-play-state
@Keyframes
- It is used to configure every frame in
animation.
- At each frame we can define effects for
object.
- Keyframes are defines with initial, final, and
intermediate steps.
Syntax:
@keyframes identifierName
{
from { effects for initial state }
to { effects for final state }
}
Syntax:
@keyframes identifier
{
0% { effects }
40% { effects }
80% { effects }
100% {effects}
}
- Keyframes are applied to any element by
using “animation-name” property
Syntax:
P{
animation-name:
keyframeIdentifierName;
}
EX:
<!DOCTYPE html>
<html>
<head>
<title>Timing</title>
<style>
.container {
overflow: hidden;
}
@keyframes slideIn
{
from
{
margin-left: 100%;
transform: scale(3);
}
to
{
margin-left: 0%;
transform: scale(1);
}
}
h2{
animation-name: slideIn;
animation-duration: 5s;
}
</style>
</head>
<body class="container">
<h2>CSS Animations</h2>
</body>
</html>
- You can add frames in between the start and
end by using step percentage.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Timing</title>
<style>
.container {
overflow: hidden;
}
@keyframes slideIn
{
from
{
margin-left: 100%;
transform: scale(1);
}
50% {
font-size: 300%;
}
to
{
margin-left: 0%;
transform: scale(1);
}
}
h2{
animation-name: slideIn;
animation-duration: 5s;
}
</style>
</head>
<body class="container">
<h2>CSS Animations</h2>
</body>
</html>
- You can control the iteration count, the
number of times to display by using
“animation-iteration-count”
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Timing</title>
<style>
.container {
overflow: hidden;
}
@keyframes slideIn
{
from
{
margin-left: 100%;
transform: scale(1);
}
50% {
font-size: 300%;
}
to
{
margin-left: 0%;
transform: scale(1);
}
}
h2{
animation-name: slideIn;
animation-duration: 5s;
animation-iteration-count: infinite;
}
</style>
</head>
<body class="container">
<h2>CSS Animations</h2>
</body>
</html>
- You can control animation direction by using
“animation-direction”
Ex
<!DOCTYPE html>
<html>
<head>
<title>Timing</title>
<style>
.container {
overflow: hidden;
}
@keyframes slideIn
{
from
{
margin-left: 100%;
transform: rotate(360deg);
}
to
{
margin-left: 0%;
transform: rotate(0deg);
}
}
img {
width: 20%;
height: 70%;
animation-name: slideIn;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-delay: 5s;
animation-timing-function: ease;
}
</style>
</head>
<body class="container">
<img src="../Images/jblspeaker.jpg"
width="100" height="100">
</body>
</html>
CSS Position
- Generally, elements are placed according to the document
layout flow.
- Position allows to make element behave differently and take
them out of the document flow.
- CSS Positions are defined by using “position” style attribute.
Static Position:
- It is according to the normal flow of document.
- It is the default position for every element.
- It will not have any effect on the element position.
- Static position is not affected by top, right, bottom, left and z-
index attributes.
Ex:
p{
position: static;
right: 10px;
}
Sticky Position:
- Element is positioned according to the normal flow of
document.
- It can make the content sticky after scrolling to the specified
margin.
- It required the margins to define and position by using left,
right, top or bottom.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Static Position</title>
<style>
h2 {
position: sticky;
top:0px;
background-color: yellow;
}
</style>
</head>
<body>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<h2>HTML Tutorial</h2>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
</body>
</html>
Ex: Accordion Sticky
<!DOCTYPE html>
<html>
<head>
<title>Accordion Stick</title>
<style>
dt {
background-color: black;
color:white;
padding: 10px;
position: sticky;
top:0px;
left:0px;
margin:1em 0;
}
</style>
</head>
<body>
<h1>Web Technologies</h1>
<dl>
<dt>HTML</dt>
<dd>Normal Elements</dd>
<dd>Void Elements</dd>
<dd>RC Data Elements</dd>
<dd>Raw Text Elements</dd>
<dd>Normal Elements</dd>
<dd>Void Elements</dd>
<dd>RC Data Elements</dd>
<dd>Raw Text Elements</dd>
<dd>Normal Elements</dd>
<dd>Void Elements</dd>
<dd>RC Data Elements</dd>
<dd>Raw Text Elements</dd>
<dd>Normal Elements</dd>
<dd>Void Elements</dd>
<dd>RC Data Elements</dd>
<dd>Raw Text Elements</dd>
<dd>Normal Elements</dd>
<dd>Void Elements</dd>
<dd>RC Data Elements</dd>
<dd>Raw Text Elements</dd>
<dd>Normal Elements</dd>
<dd>Void Elements</dd>
<dd>RC Data Elements</dd>
<dd>Raw Text Elements</dd>
<dt>JavaScript</dt>
<dd>Variable</dd>
<dd>DataTypes</dd>
<dd>Operators</dd>
<dd>Statements</dd>
<dd>Variable</dd>
<dd>DataTypes</dd>
<dd>Operators</dd>
<dd>Statements</dd>
<dd>Variable</dd>
<dd>DataTypes</dd>
<dd>Operators</dd>
<dd>Statements</dd>
<dd>Variable</dd>
<dd>DataTypes</dd>
<dd>Operators</dd>
<dd>Statements</dd>
<dd>Variable</dd>
<dd>DataTypes</dd>
<dd>Operators</dd>
<dd>Statements</dd>
<dt>CSS </dt>
<dd>Selectors</dd>
<dd>Units</dd>
<dd>Positions</dd>
<dd>Box Layout</dd>
<dd>Selectors</dd>
<dd>Units</dd>
<dd>Positions</dd>
<dd>Box Layout</dd>
<dd>Selectors</dd>
<dd>Units</dd>
<dd>Positions</dd>
<dd>Box Layout</dd>
<dd>Selectors</dd>
<dd>Units</dd>
<dd>Positions</dd>
<dd>Box Layout</dd>
<dd>Selectors</dd>
<dd>Units</dd>
<dd>Positions</dd>
<dd>Box Layout</dd>
<dd>Selectors</dd>
<dd>Units</dd>
<dd>Positions</dd>
<dd>Box Layout</dd>
</dl>
</body>
</html>
Fixed Position:
- The element is removed from normal document flow.
- Element is no longer a part of DOM flow.
- Its position is fixed with left, right, top and bottom attributes.
- It will not move from the position defined.
- It locks the component at fixed position on page.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Fixed Position</title>
<link rel="stylesheet" href="../Fonts/css/all.css">
<style>
div {
border: 2px solid;
padding: 10px;
}
aside {
width: 200px;
padding: 10px;
height: 30px;
border:3px solid darkred;
background-color: darkolivegreen;
color:white;
text-align: center;
position: fixed;
top:100px;
right:100px;
}
</style>
</head>
<body>
<div>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<p>Depending on how you obtained the Windows software,
this is a license agreement between (i) you and the device
manufacturer or software installer that distributes the software
with your device; or (ii) you and Microsoft Corporation (or, based
on where you live or, if a business, where your principal place of
business is located, one of its affiliates) if you acquired the
software from a retailer.</p>
<aside>
<span class="fa fa-shopping-cart"></span> Your Cart Items
</aside>
</div>
</body>
</html>
Relative Position
- It according to the normal document flow.
- Its position will be relative to adjacent or parent element.
- It is from the parent or from adjacent.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Fixed Position</title>
<link rel="stylesheet" href="../Fonts/css/all.css">
<style>
.box1, .box2, .box3 {
width: 200px ;
height: 100px;
background-color: yellow;
border:1px solid black;
}
.box2 {
position: relative;
margin-left: 30px;
}
.boxinner {
position: relative;
margin-left: 30px;
border:2px solid;
height: 100px;
}
.container {
margin-left: 60px;
border:1px solid;
}
</style>
</head>
<body>
<div class="container">
<div class="box1">
</div>
<div class="box2">
<div class="boxinner">
</div>
</div>
<div class="box3">
</div>
</div>
</body>
</html>
Position Absolute
- The element is removed from the normal document flow.
- It is positioned relative to its closest element.
- It is affected by using left, right, top and bottom values.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Absolute Position</title>
<style>
#container {
border:2px solid;
background-color: yellow;
}
aside {
position: absolute;
border:1px dotted;
width: 100px;
top:100px;
right: 10px;
}
#ads {
width: 200px;
height: 300px;
position:absolute;
border:1px double;
}
#adsInner {
position: absolute;
width: 150px;
height: 150px;
border:2px solid;
}
</style>
</head>
<body>
<div id="container">
<p>some text..</p>
<div id="ads">
Parent
<div id="adsInner">
Child
<aside>Ads here..</aside>
</div>
</div>
</div>
</body>
</html>
Styles and CSS
- Styles are set of attributes defined for HTML elements to make the presentation
more interactive and responsive.
- HTML elements have attributes but limited in functionality, style attributes make
HTML more effective. They extend HTML element.
- Styles can be defined in 3 ways
o Inline Styles
o Embedded Styles
o External Style Sheet
Inline Styles:
- The styles are defined for elements by using “style” attribute.
- Every element has its own individual styles.
- The styles defined for one element can’t be re-used for other elements.
- These styles are faster in rendering as they are local to element.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
</head>
<body>
<h2 style="background-color: green; color:white; text-align: center;">HTML</h2>
<h2>CSS</h2>
<h2>JavaScript</h2>
</body>
</html>
Embedded Styles:
- Styles are defined in page by using <style> element.
- You configure in head or body section.
- You can keep all your styles at one location and use across various elements.
- It is good for reusing styles.
- Slower that inline.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
h2 {
background-color: green;
color: white;
text-align: center;
}
</style>
</head>
<body>
<h2>HTML</h2>
<h2>CSS</h2>
<h2>JavaScript</h2>
</body>
</html>
FAQ: Where to embed the styles, in head or in body?
A. If you want to configure a set of style, which are loaded into browser memory, and
used later by the elements according to the requirement then keep in <head>
section.
If you want to configure a set of styles, which are applied directly on body load then
better define them in <body>.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
.heading {
background-color: green;
color: white;
text-align: center;
}
</style>
</head>
<body>
<style>
body {
background-color: lightgreen;
}
</style>
<h2 class="heading">HTML</h2>
<h2>CSS</h2>
<h2>JavaScript</h2>
</body>
</html>
Type Selector
- Type selector refers to HTML element tag name [Image <img>, Bold <b>].
- The given styles will be applied to specified tag where ever it is used in page.
- It will apply effects to every occurrence of the tag in page. You can’t disable for any
specific.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
h2
{
background-color:red;
color:white;
text-align:center;
}
</style>
</head>
<body>
<h2>HTML</h2>
<p>It is a markup language.</p>
<h2>CSS</h2>
<p>Defines styles of HTML.</p>
<h2>JavaScript</h2>
<p>Handles client side interactions.</p>
</body>
</html>
ID Selector
- Every element can be defined with ID.
- You can use ID to access the element and apply effects.
- You can choose to which element you want the effects.
- Element is defined with ID
<div id=”effects”> </div>
- You can access the ID in styles by using “#” reference
<style>
#effects
{
}
</style>
- Every tag can use only one ID reference.
- If you have configured multiple categories of styles with ID selector and want to use
for specific tag, then it is not possible to define all effects to one element.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
#textEffects {
text-align: center;
color:yellow;
}
#bgEffects {
background-color: red;
}
</style>
</head>
<body>
<h2 id="textEffects">HTML</h2>
<p>It is a markup language.</p>
<h2 id="bgEffects">CSS</h2>
<p>Defines styles of HTML.</p>
<h2>JavaScript</h2>
<p>Handles client side interactions.</p>
</body>
</html>
Class Selector
- A class selector is defined by using “.”
- Class is accessed and applied to element by using “class” attribute.
- Every tag can implement multiple classes.
- Multiple classes are specified with space.
<style>
.cssClassName
{
}
</style>
<div class=”cssClassName1 cssClassName2”> </div>
- The CSS selectors are further classified into various groups based on behaviour
o Combinators / Rational Selectors
o Attribute Selectors
o Pseudo Selectors
o Structural Pseudo Selectors
Rational or Combinators
- These selector default with parent and child elements as well as with elements that
have relation.
- Relation like adjacent, below, above, before, after, first, last etc..
Selector Description
Descendent Selector Targets all tags under specified parent. It includes any level
hierarchy.
It defines the parent element and the child element by using
space.
Syntax:
parentElement childElement {
}
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
ol li {
color: red;
}
div p {
color:green;
}
</style>
</head>
<body>
<h2>Web Technologies</h2>
<ol>
<li>HTML
<ol>
<li>Void Elements</li>
<li>Normal Elements</li>
</ol>
</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
<div>
<blockquote>Blockquote...</blockquote>
<p>Para-1</p>
<div>
<p>Para-2</p>
</div>
</div>
<p>Para-3</p>
</body>
</html>
Child Selector It applies effects only to the direct child of parent element.
Syntax:
Parent > child {
}
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
div>p {
color:red;
}
</style>
</head>
<body>
<div>
<p>Para-1</p>
</div>
<div>
<span>
<p>Para-2</p>
</span>
</div>
</body>
</html>
Adjacent Sibling It defines effects to an element which is specified immediately
after current element.
It is not parent and child, it is one below another.
It will apply only to the first adjacent element.
Syntax:
FirstElement + adjacentElement
{
}
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
h2+p {
color:red;
}
</style>
</head>
<body>
<h2>HTML Elements</h2>
<p>Para-1</p>
<p>Para-2</p>
<p>Para-3</p>
<p>Para-4</p>
</body>
</html>
General Sibling It defines effects to all elements which are specified after the
current element.
Syntax:
FirstElement ~ AdjacentElements
{
}
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
h2~p {
color:red;
}
</style>
</head>
<body>
<h2>HTML Elements</h2>
<p>Para-1</p>
<p>Para-2</p>
<p>Para-3</p>
<p>Para-4</p>
</body>
</html>
Attribute Selectors
- Several elements in HTML are presented by using attribute of tag.
<input type=”button”>
<input type=”radio”>
- “type” is attribute.
- We have to apply effects based on attribute and value.
Syntax:
tagName[“attribute”] { }
tagName[“attribute=value”] { }
Condition Purpose
[attribute=”val”] Equal specifies that it should be exact match.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p[class="Effect"] {
color:red;
}
</style>
</head>
<body>
<p class="paraEffect">Para-1</p>
<p class="para">Para-2</p>
<p class="Effectpara">Para-3</p>
<p class="Effect">Para-4</p>
</body>
</html>
[attribute^=”val”] It refers the value starting with specified
term.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p[class^="Effect"] {
color:red;
}
</style>
</head>
<body>
<p class="paraEffect">Para-1</p>
<p class="para">Para-2</p>
<p class="Effectpara">Para-3</p>
<p class="Effect">Para-4</p>
</body>
</html>
[attribute$=”val”] It specifies that the value ending with given
term.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p[class$="Effect"] {
color:red;
}
</style>
</head>
<body>
<p class="paraEffect">Para-1</p>
<p class="para">Para-2</p>
<p class="Effectpara">Para-3</p>
<p class="Effect">Para-4</p>
</body>
</html>
[attribute*=”val”] It matches the term at any location.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p[class*="Effect"] {
color:red;
}
</style>
</head>
<body>
<p class="paraEffect">Para-1</p>
<p class="para">Para-2</p>
<p class="Effectpara">Para-3</p>
<p class="Effect">Para-4</p>
</body>
</html>
[attribute|=”val”] Name starts with specified term and
separated with “-“.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p[class|="Effect"] {
color:red;
}
</style>
</head>
<body>
<p class="para-Effect">Para-1</p>
<p class="para">Para-2</p>
<p class="Effect-para">Para-3</p>
<p class="Effect">Para-4</p>
</body>
</html>
[attribute~=”val”] Name start with specified term and contain
blank space.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p[class~="Effect"] {
color:red;
}
</style>
</head>
<body>
<p class="para-Effect">Para-1</p>
<p class="Effect para">Para-2</p>
<p class="Effect-para">Para-3</p>
<p class="Effect">Para-4</p>
</body>
</html>
Dynamic Pseudo-Classes
- Dynamic indicates that the effect can change according to state and
situation.
- Pseudo indicates that it is not referring to exactly the element which is
having the same name as selector name.
- The selector name and the element if effects may differ.
Syntax:
link - not <link> element, it refers to <a>
class/Id/type: pseudoClass {
}
Selector Description
:link Specifies effect for Hyperlink.
:visited It defines effects for visited links.
:hover It defines effects when mouse pointer is over
element.
:active It defines effects when link is in active state.
:focus It defines effects when element get focus.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
.txtName+span {
display: none;
}
.txtName:focus+span {
display: inline;
}
</style>
</head>
<body>
<div>
<label>Name</label>
<div>
<input class="txtName" type="text">
<span>Name 4 Chars</span>
</div>
</div>
</body>
</html>
Syntax:
Element:Link { }
#heading:hover {}
.txtName:focus { }
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
.txtName+span {
display: none;
}
.txtName:focus+span {
display: inline;
}
input:focus {
border:2px solid darkcyan;
box-shadow: 2px 2px 3px darkcyan;
}
a{
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
color:red;
}
a:visited {
color:green
}
a:link {
color: gray;
}
</style>
</head>
<body>
<div>
<label>Name</label>
<div>
<input class="txtName" type="text">
<span>Name 4 Chars</span>
</div>
</div>
<div>
<a href="home.html">Home</a>
<span>|</span>
<a href="http://www.flipkart.com">Flipkart</a>
</div>
</body>
</html>
Target pseudo class
Selector Description
:target - It defines effects to any element when it becomes target of a
link.
- You can implement in intra document navigation.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Target</title>
<style>
ul {
list-style: none;
display: flex;
}
li {
margin-left: 50px;
border:2px solid darkblue;
padding: 10px;
width: 200px;
text-align: center;
border-radius: 10px;
}
.group {
border:2px solid darkgreen;
background-color: lightgreen;
color:black;
margin-top: 20px;
padding: 10px;
}
.group:target {
background-color: black;
color:white;
}
</style>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="#html">HTML</a></li>
<li><a href="#css">CSS</a></li>
<li><a href="#js">JavaScript</a></li>
</ul>
</nav>
</header>
<section>
<div id="html" class="group">
<h3>HTML</h3>
<p>It is a markup language.</p>
</div>
<div id="css" class="group">
<h3>CSS</h3>
<p>It is to define styles</p>
</div>
<div id="js" class="group">
<h3>JavaScript</h3>
<p>It is a language.</p>
</div>
</section>
</body>
</html>
Selector Description
:enabled It defines effects when element is enabled.
:disabled It defines effects when element is disabled.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>State</title>
<style>
input:read-only {
background-color: gainsboro;
color: gray;
}
button:disabled {
cursor:not-allowed;
}
button:enabled {
cursor:grab;
}
</style>
</head>
<body>
<fieldset>
<legend>User Name</legend>
<div>
<input readonly type="text"
value="John">
<button disabled>Submit</button>
</div>
</fieldset>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>State</title>
<style>
input[type="checkbox"]+span {
color:red;
}
input[type="checkbox"]:checked+span {
color: green;
}
</style>
</head>
<body>
<fieldset>
<legend>Terms of Service</legend>
<textarea rows="4" cols="40">
Read our terms and conditions..
</textarea>
<div>
<input type="checkbox"> <span>I
Accept</span>
</div>
</fieldset>
</body>
</html>
Selector Description
:valid It defines effects for element if is value is valid against the
validation defined. Validation can be verified by using:
- Minlength
- Maxlength
- Required
- Pattern
- Email
- URL etc.
:invalid It defines effect for element when it is invalid.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>State</title>
<style>
#txtName:valid+span {
display: none;
}
#txtName:invalid+span {
display: inline;
}
#txtName:valid {
border:2px solid green;
box-shadow: 2px 2px 3px green;
}
#txtName:invalid {
border:2px solid red;
box-shadow: 2px 2px 3px red;
}
</style>
</head>
<body>
<div class="form-group">
<label>User Name</label>
<div>
<input id="txtName" type="text" minlength="4">
<span>Name too short</span>
</div>
</div>
</body>
</html>
:in-range It defines effects for element when input value is within the
specified range.
:out-of-range It defines effects for element when input value is out of given
range.
Range is verified with “min and max” values defined for input
element.
EX:
<!DOCTYPE html>
<html>
<head>
<title>State</title>
<style>
input:in-range {
border: 2px solid green;
box-shadow: 2px 3px 4px green;
}
input:out-of-range {
border: 2px solid red;
box-shadow: 2px 3px 4px red;
}
</style>
</head>
<body>
<div class="form-group">
<label>Age</label>
<div>
<input type="number" min="16" max="35">
</div>
</div>
</body>
</html>
:required It defines effects to element when it verified with required
error. It is not validating required, It is just verifying whether
the required defined or not.
:optional If it is not defined with required validation then it is treated as
optional.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>State</title>
<style>
input:in-range {
border: 2px solid green;
box-shadow: 2px 3px 4px green;
}
input:out-of-range {
border: 2px solid red;
box-shadow: 2px 3px 4px red;
}
.form-group {
margin-top: 20px;
}
#txtName:optional+div {
display: none;
}
#txtName:required+div {
display: block;
color:red;
}
#txtName:valid+div {
display: none;
}
</style>
</head>
<body>
<div class="form-group">
<label>Age</label>
<div>
<input type="number" min="16" max="35">
</div>
</div>
<div class="form-group">
<label>Name</label>
<div>
<input required id="txtName" type="text">
<div>Name required</div>
</div>
</div>
</body>
</html>
Structural Pseudo Selector:
- You can target your effects based on the position of element in parent and child
hierarchy.
Selector Description
:first-child It defines effects only for first child element.
:last-child It defines effects only for last child element.
:nth-child(LevelNumber) It defines effects only to specific child element that
occurs at given level.
Level number starts with 1.
Index number starts with 0.
You can also define the pre-set values like ‘even &
odd’ to apply effects based on even and odd
occurrences.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Structure</title>
<style>
ol > li:first-child {
color:red;
}
ol > li:last-child {
color:blue;
}
ol > li:nth-child(3){
color: green;
font-size: 30px;
}
</style>
</head>
<body>
<ol>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
</ol>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Structure</title>
<style>
ol > li:nth-of-type(2n+1){
color:red;
}
</style>
</head>
<body>
<ol>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
</ol>
</body>
</html>
:nth-last-of-type(n) It will apply effect for every nth occurrence from
bottom.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Structure</title>
<style>
ol > li:nth-last-of-type(2n+1){
color:red;
}
</style>
</head>
<body>
<ol>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
<li>Item-6</li>
<li>Item-7</li>
<li>Item-8</li>
</ol>
</body>
</html>
:nth-last-child(n) It will apply from bottom without repeating.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Structure</title>
<style>
ol > li:nth-last-child(2){
color:red;
}
</style>
</head>
<body>
<ol>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
<li>Item-6</li>
<li>Item-7</li>
<li>Item-8</li>
</ol>
</body>
</html>
:root It refers to root of document, which is ‘body’
Ex:
:root {
font-family:Arial;
}
:empty If any element is empty, without any content then its
will define the given effects.
You can configure for containers like <div>, <span>,
<td>, <dd>, <p> etc.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Odd Even</title>
<style>
thead > tr {
background-color: darkcyan;
color:white;
}
tbody > tr:nth-child(even) {
background-color: lightcyan;
}
tbody > tr:nth-child(odd){
background-color: lightgreen;
}
tbody > tr > td:empty {
background-color: red;
}
</style>
</head>
<body>
<table border="1" width="400">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>TV</td>
<td>45000.55</td>
</tr>
<tr>
<td>Mobile</td>
<td>41000.22</td>
</tr>
<tr>
<td>Nike</td>
<td></td>
</tr>
<tr>
<td>Shirt</td>
<td>4100.33</td>
</tr>
</tbody>
</table>
</body>
</html>
Pseudo-Element Selectors:
Selector Description
::first-line Effects for first line in paragraph.
::first-letter Effects for first character.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Element Selectors</title>
<style>
p::first-letter {
font-family: Arial;
font-size: 30px;
color:red;
}
p::first-line {
color:red;
}
</style>
</head>
<body>
<p>Depending on how you obtained the Windows software, this
is a license agreement between (i) you and the device manufacturer
or software installer that distributes the software with your device; or
(ii) you and Microsoft Corporation (or, based on where you live or, if a
business, where your principal place of business is located, one of its
affiliates) if you acquired the software from a retailer. Microsoft is the
device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software
directly from Microsoft. Note that if you are a volume license
customer, use of this software is subject to your volume license
agreement rather than this agreement.
</p>
</body>
</html>
::before Effect or content to add before the current element.
::after Effect or content to add after the current element.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Before After</title>
<style>
ul {
display: flex;
list-style: none;
}
li::before {
content: "-->";
}
li:first-child::before {
content: "";
}
</style>
</head>
<body>
Site Map
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Contact</li>
<li>Login</li>
</ul>
</nav>
</body>
</html>
::placeholder It will apply effects for placeholder.
::selection It will apply effects for selection.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Languages</title>
<style>
*{
font-style: italic;
}
input::placeholder {
color:lightgreen;
}
p::selection {
background-color: yellow;
}
</style>
</head>
<body>
<p>Some content.. select and see..</p>
<dl>
<dt>Name</dt>
<dd><input placeholder="Name 4 chars" type="text"></dd>
<dt>Password</dt>
<dd><input disabled type="password"></dd>
<dt>Mobile</dt>
<dd><input required type="text"></dd>
</dl>
</body>
</html>
Language Selector:
- It defines effects based on lang configured for element.
- If you page is multi lingual then you can define effects to content based on specific
language.
“:lang()”
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Languages</title>
<style>
p:lang(en){
font-style: italic;
}
</style>
</head>
<body>
<h2>Language Selector</h2>
<p>Some Text</p>
<p lang="en">English US</p>
</body>
</html>
Negation Selector
- It is used to define effects for the elements which are not matching with specified
criteria.
- The negation selector is defined using “:not()”
- It will ignore effects for specific element and apply for other.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Languages</title>
<style>
p:not(#effects){
color:red;
}
</style>
</head>
<body>
<p>Para-1</p>
<p id="effects">Para-2</p>
<p>Para-3</p>
<p id="styles">Para-4</p>
<p id="effects">Para-5</p>
</body>
</html>
- You can also configure for properties.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Languages</title>
<style>
input:not([disabled]) {
background-color: lightgreen;
}
</style>
</head>
<body>
<dl>
<dt>Name</dt>
<dd><input type="text"></dd>
<dt>Password</dt>
<dd><input disabled type="password"></dd>
<dt>Mobile</dt>
<dd><input required type="text"></dd>
</dl>
</body>
</html>
Universal Selector:
- It is defined by using “*” that represents all.
- It apply effects to all elements.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Languages</title>
<style>
*{
font-style: italic;
}
</style>
</head>
<body>
<dl>
<dt>Name</dt>
<dd><input type="text"></dd>
<dt>Password</dt>
<dd><input disabled type="password"></dd>
<dt>Mobile</dt>
<dd><input required type="text"></dd>
</dl>
</body>
</html>
JavaScript
- JavaScript is a language.
- It is an open source, cross platform, interpreted and just-in-time
compiled programming language.
- Interpreter is a translated that translates line by line.
- Just-in-time is a compiler that compiles in browser when requested by
client.
- V8 is JavaScript compiler.
- JavaScript is used
o Client Side with HTML
o Server Side with Node.js
o Database with MongoDB
o Animations with Flash
- JavaScript supports various types of programming like, imperative,
functional programming, structural programming and object-oriented
programming.
- In early 1994 Brendan Eich introduces a script called “Mocha” for
Netscape browser.
- After that “Moca” was renamed into “Live Script”
- 1995 Sun Microsystems took responsibility of maintaining Live Script and
re-named as “JavaScript”.
- JavaScript Designed by “Brendan Eich”
- JavaScript initially belong to “Netscape communications”.
- JavaScript follows the standards of “ECMA” [European Computer
Manufacturers Association].
- JavaScript versions are ECMAScript 2015, ES6, ES8 ES2020
- ES5, ES6 are most commonly used versions in various web technologies.
- ES6
Issues with JavaScript
- Browser incompatibility: Every browser has its own extensions to
JavaScript and every browser have its own parser [translator].
- JavaScript is not secured: It is client side. Everyone can view.
- JavaScript can be disabled by browser. [Browser can block JavaScript].
- JavaScript is not strongly typed language.
var x = 10; // number
x = “John”; // string – valid
JavaScript with HTML
- JavaScript is used to manipulate the HTML DOM.
- It converts the static DOM elements into dynamic DOM elements.
- JavaScript can add elements, remove elements, modify the data, handle
validations, handle plugins, browser location, history etc.
- JavaScript can reduce burden on server by managing several interactions
client-side.
JavaScript Inline:
- JavaScript functions are defined within the element.
- They are faster as they are local to element.
- They can’t be re-used.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Inline</title>
</head>
<body>
<h2>Click Print Button to Print Page</h2>
<button onclick="window.print()">Print Page</button>
</body>
</html>
JavaScript Embedded:
- You can write the JavaScript functions and embed into page by using
<script> element.
- You can embed in head section or body section.
- You can re-use the functions across the page from any element.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Inline</title>
<script>
function PrintPage(){
window.print();
}
</script>
</head>
<body>
<h2>Click Print Button to Print Page</h2>
<button onclick="PrintPage()">Print Page</button>
<button onclick="PrintPage()">Print</button>
</body>
</html>
- Embedded scripts require MIME type to define.
- The JavaScript MIME type is “text/javascript” or “language=JavaScript”
Syntax:
<script type="text/javascript" language="javascript">
function PrintPage(){
window.print();
}
</script>
JavaScript Strict Mode:
- JavaScript is recommended to write in “Strict” mode.
- It reduces the code inconsistency.
- You can turn ON strict mode by using “use strict” in the code.
Ex:
<script>
"use strict";
function f1()
{
x = 10; // x is not declared as variable
document.write("x=" + x);
}
f1();
</script>
Note: remove “use strict” from <script> element, the above code will
work normally. In strict mode you have to declare a variable “var x”.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
.effects {
background-color: yellow;
}
</style>
<title>Reference</title>
<script type="text/javascript">
function bodyload(){
x = document.getElementsByName("pay");
alert("Total Payment Methods: " + x.length);
}
</script>
</head>
<body onload="bodyload()">
<fieldset>
<legend>Payment</legend>
<input type="radio" name="pay" value="Cash"> Cash
<input type="radio" name="pay" value="UPI"> UPI
<input type="radio" name="pay" value="Credit Card"> Credit Card
</fieldset>
</body>
</html>
alert():
It is used to display output in a message box.
User have to confirm the message in order to continue.
Syntax:
alert(“message/ expression”);
You can’t cancel alert. “esc” key is similar to OK.
EX:
<!DOCTYPE html>
<html>
<head>
<style>
.effects {
background-color: yellow;
}
</style>
<title>Reference</title>
<script type="text/javascript">
function DeleteClick(){
alert("Record Deleted");
}
</script>
</head>
<body>
<button onclick="DeleteClick()">Delete</button>
</body>
</html>
confirm():
It is similar to alert, but provides option to cancel the message.
It returns true on OK and false on Cancel.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
.effects {
background-color: yellow;
}
</style>
<title>Reference</title>
<script type="text/javascript">
function DeleteClick(){
x = confirm("Are you sure want to Delete?");
if(x==true){
alert("Record Deleted");
} else {
alert("Canceled..");
}
}
</script>
</head>
<body>
<button onclick="DeleteClick()">Delete</button>
</body>
</html>
document.write()
It is used to print output in a new screen of same page.
The output is erased when you refresh the page.
EX:
<!DOCTYPE html>
<html>
<head>
<style>
.effects {
background-color: yellow;
}
</style>
<title>Reference</title>
<script type="text/javascript">
function DeleteClick(){
x = confirm("Are you sure want to Delete?");
if(x==true){
document.write("Record Deleted");
} else {
alert("Canceled..");
}
}
</script>
</head>
<body>
<button onclick="DeleteClick()">Delete</button>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
.effects {
background-color: yellow;
}
</style>
<title>Reference</title>
<script type="text/javascript">
function DeleteClick(){
x = confirm("Are you sure want to Delete?");
if(x==true){
document.getElementById("msg").innerText="<font
color='red'>Record Deleted</font>";
} else {
alert("Canceled..");
}
}
</script>
</head>
<body>
<button onclick="DeleteClick()">Delete</button>
<p align="center" id="msg"></p>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
.effects {
background-color: yellow;
}
</style>
<title>Reference</title>
<script type="text/javascript">
function DeleteClick(){
x = confirm("Are you sure want to Delete?");
if(x==true){
document.getElementById("msg").innerHTML="<font
color='red'>Record Deleted</font>";
} else {
alert("Canceled..");
}
}
</script>
</head>
<body>
<button onclick="DeleteClick()">Delete</button>
<p align="center" id="msg"></p>
</body>
</html>
innerHTML will add inside existing element.
outerHTML will add by replacing existing element.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
.effects {
background-color: yellow;
}
</style>
<title>Reference</title>
<script type="text/javascript">
function DeleteClick(){
x = confirm("Are you sure want to Delete?");
if(x==true){
document.getElementById("msg").outerHTML="<h2><font
color='red'>Record Deleted</font></h2>";
} else {
alert("Canceled..");
}
}
</script>
</head>
<body>
<button onclick="DeleteClick()">Delete</button>
<p align="center" id="msg"></p>
</body>
</html>
Console options
<!DOCTYPE html>
<html>
<head>
<style>
.effects {
background-color: yellow;
}
</style>
<title>Reference</title>
<script type="text/javascript">
function DeleteClick(){
x = confirm("Are you sure want to Delete?");
console.info("Delete Initiated");
if(x==true){
console.error("Delete Completed");
document.getElementById("msg").outerHTML="<h2><font
color='red'>Record Deleted</font></h2>";
} else {
alert("Canceled..");
console.warn("Canceld action");
}
}
</script>
</head>
<body>
<button onclick="DeleteClick()">Delete</button>
<p align="center" id="msg"></p>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Input</title>
<style>
label {
font-weight: bold;
}
.box{
width: 300px;
justify-content: center;
align-items: center;
margin: auto;
}
</style>
<link rel="stylesheet"
href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script
src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script>
function RegisterClick(){
document.getElementById("lblName").innerText =
document.getElementById("txtName").value;
document.getElementById("lblPrice").innerText =
document.getElementById("txtPrice").value;
document.getElementById("lblCity").innerText =
document.getElementById("lstCities").value;
stock = document.getElementById("optStock");
status = "";
if(stock.checked){
status = "Available";
} else {
status = "Out of Stock";
}
document.getElementById("lblStock").innerText = status;
document.getElementById("lblMfd").innerText =
document.getElementById("txtMfd").value;
}
</script>
</head>
<body class="container-fluid">
<div class="box">
<form>
<h2 class="text-primary text-center">Register Product</h2>
<div class="form-group">
<label>Name</label>
<div>
<input type="text" id="txtName" class="form-control">
</div>
</div>
<div class="form-group">
<label>Price</label>
<div>
<input type="text" id="txtPrice" class="form-control">
</div>
</div>
<div class="form-group">
<label>Shipped To</label>
<div>
<select id="lstCities" class="form-control">
<option value="Delhi">Delhi</option>
<option value="Hyderabad">Hyderabad</option>
</select>
</div>
</div>
<div class="form-group">
<label>Manufactured</label>
<div>
<input type="date" id="txtMfd" class="form-control">
</div>
</div>
<div class="form-group">
<label>In Stock</label>
<div>
<input type="checkbox" id="optStock"> Yes
</div>
</div>
<div class="form-group">
<button onclick="RegisterClick()" type="button" data-
target="#summary" data-toggle="modal" class="btn btn-primary btn-
block">Register</button>
</div>
</form>
</div>
<div class="modal fade" id="summary">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2>Product Details</h2>
<button class="close" data-dismiss="modal" >x</button>
</div>
<div class="modal-body">
<table class="table table-hover">
<tr>
<td>Name</td>
<td id="lblName"></td>
</tr>
<tr>
<td>Price</td>
<td id="lblPrice"></td>
</tr>
<tr>
<td>Shipped To</td>
<td id="lblCity"></td>
</tr>
<tr>
<td>Stock</td>
<td id="lblStock"></td>
</tr>
<tr>
<td>Manufactured</td>
<td id="lblMfd"></td>
</tr>
</table>
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-
primary">OK</button>
</div>
</div>
</div>
</div>
</body>
</html>
JavaScript Language Basics
- Variables
- Data Types
- Operators
- Statements
- Functions
Variables in JavaScript
- Variables are storage locations in memory where you can store a value
and use it as a part of any expression.
- Variables configuration contains 3 stages
o Declaration
o Assigning or Rendering
o Initialization
}
f1();
</script>
- Let allows declaration, rendering, initialization.
Ex:
<script>
"use strict";
function f1(){
let x = 10; // intialization
if(x==10) {
let y; // declaration
y = 20; // rendering
document.write("X=" + x + "<br>" + "Y=" + y);
}
}
f1();
</script>
- Let will not allow shadowing.
- There can’t be same name identifier with in the scope.
<script>
"use strict";
function f1(){
let x = 10; // intialization
if(x==10) {
let x = 20;
let x = 30; // invalid – shadowing not
allowed
let y; // declaration
y = 20; // rendering
document.write("X=" + x + "<br>" + "Y=" + y);
}
}
f1();
</script>
- Let will not allow hoisting.
Ex:
<script>
"use strict";
function f1(){
x = 10;
document.write("X=" + x);
let x; // Not Allowed
}
f1();
</script>
const:
- It is also a block scope variable.
- It will allow only initialization, no declaration, no rendering.
- It will not allow shadowing.
- It will not allow hoisting.
Ex:
<script>
"use strict";
function f1(){
const x; // not allowed
x= 10;
document.write("x=" + x);
}
f1();
</script>
Ex:
<script>
"use strict";
var x = 10;
let y = 20;
const z = 30;
function f1(){
window.a = 40; //window refers to browser
document.write(`f1 values: <br>
x=${x}<br>y=${y}<br>z=${z}<br>a=${a}<br>`);
}
function f2(){
document.write(`f2 values: <br> x=${x}<br>y=${y}<br>z=${z}<br>a=${a}`);
}
f1();
f2();
</script>
Variables Naming
- Variable name must start with an alphabet or underscore _
- It can be alpha numeric, but can’t start with number.
Syntax:
var jan2020 = 12000;
var 2020jan = 23000; invalid
var _2020jan = 34000; valid
var jan_2020 = 34000; valid
FAQ: Why underscore is supported? What underscore means?
A. Underscore is special symbol that doesn’t have any compile time issues.
underscore is used by developers to indicate that the variable
requires
further implementation.
“Marked for Implementation”
- ECMA standards prefer variable name length maximum 255 chars.
- Variable name must speak what it is.
- Always use camel case for naming references.
class EmployeeSalary
{
}
var employeeSalary = new Employee();
var txtName;
var txtPassword;
var btnSubmit;
Data Types
- Data type determines the data structure.
- Data structure specifies the size and behaviour of value in memory.
- Data Type uses a data structure to define the type of value that can be
stored in memory.
- JavaScript is implicitly typed; the data type is determined according to
the value assigned. There is no specific built-in type.
- JavaScript is not strongly typed, you can store any contradictory values.
Syntax:
var x = “John”; //string
x = 10; // valid and x changes to number
What type of values JavaScript can handle?
The JavaScript data types are classified into 2 groups
- Primitive Types
- Non-Primitive Types
Primitive Types
- Primitive types are stored in memory stack. [LIFO]
- They have a fixed range for values.
- They are Immutable types.
- Their values can’t change according to state and situation.
- JavaScript primitive types are
o Number
o String
o Boolean
o Null
o Undefined
Number Type:
- Number type is used to handle a numeric value.
- JavaScript number type can allow
o Signed Integer
var x = -10;
var x = +10;
o Unsigned Integer
var x = 10;
o Floating point
var x = 4.5;
var x = 33.55;
o Double
var x = 553.558
o Decimal
var x = 45600.6669594; [29 decimal places]
o Hexa
0xf00d
o Binary
0b1010
o Octa
0o744
o Exponent
Var x = 2e3; [2 x 103] = 2000
BigInt = 100n; [Binary Data – images - complex]
Ex:
<script>
"use strict";
function f1(){
document.write(`Min Integer: ${Number.MIN_SAFE_INTEGER} <br> Max
Integer: ${Number.MAX_SAFE_INTEGER}`);
}
f1();
</script>
Validating Numbers
- The operator “typeof” is used to verify and return the data type of variable.
- IsNaN() is a JavaScript that verifies whether the give value is a number or any other type.
- Every value you entered in form element will be “string” type.
- You have to convert the string into number by using the functions
o parseInt()
o parseFloat()
Ex:
<script>
var x = 10;
var y = "4";
if(isNaN(y)){
document.write("Invalid Number");
} else {
var z = x * y;
document.write("z=" + z);
</script>
Ex:
<script>
if(isNaN(y)){
document.write("Invalid Number");
} else {
var z = x * y;
document.write("z=" + z);
</script>
String Type
- String is a literal with group of characters enclosed in Quotes.
- JavaScript string can be enclosed in
o Single Quote ‘ ‘
o Double Quote “ “
o Back Tick ` `
- Single and double quotes are used to swap between inner and outer
string.
Ex:
<script>
"use strict";
function f1(){
var link = "<a href='home.html'>Home</a>";
document.write(link);
}
f1();
</script>
Ex:
<script>
"use strict";
function f1(){
var link = '<a href="home.html">Home</a>';
document.write(link);
}
f1();
</script>
Back Tick:
- Back Tick [` `] is available from ES5
- It is used to define a string with embedded expression.
- Expression can be embedded with “${}”
- Expression can’t be embedded into string with single or double quote.
Ex:
<script>
"use strict";
function f1(){
var age = 20;
var year = 2020;
document.write("You will be" + " " + (age+1) + " " + "Next Year" + " " +
(year+1) + "<br>");
document.write(`You will be ${age+1} Next Year ${year+1}`);
}
f1();
</script>
Ex:
<script>
"use strict";
function f1(){
var title = "Admin Login";
var login = `
<h2>${title}</h2>
<dl>
<dt>Name</dt>
<dd><input type="text"></dd>
<dt>Price</dt>
<dd><input type="text"></dd>
</dl>
<button>Login</button>
`;
document.write(login);
}
f1();
</script>
- Several special characters defined in a string will escape printing.
- To print the non-printable characters, we have to use “\”.
Ex:
<script>
"use strict";
function f1(){
var path = "\"D:\\Images\\Pics\\mobile.jpg\"";
document.write(path);
}
f1();
</script>
Ex:
<script>
"use strict";
function f1(){
alert("Hello \n Welcome \n to \n JavaScript");
document.write("Hello ! <br> Welcome");
}
f1();
</script>
Note: The numbers or the values that you access from any element are string
type. You have to convert the string into number to handle expressions.
JavaScript functions to convert string into number.
- parseInt()
- parseFloat()
Ex:
<!DOCTYPE html>
<html>
<head>
<title>String</title>
<script>
function Calculate(){
var txt1 = document.getElementById("txt1").value;
var txt2 = document.getElementById("txt2").value;
document.getElementById("result").innerHTML = parseFloat(txt1) +
parseFloat(txt2);
}
</script>
</head>
<body>
<dl>
<dt>Number-1</dt>
<dd><input id="txt1" type="text"></dd>
<dt>Number-2</dt>
<dd><input id="txt2" type="text"></dd>
</dl>
<button onclick="Calculate()">Calculate</button>
<h2 id="result"></h2>
</body>
</html>
String Manipulation Functions
- JavaScript string object provides a set of properties and methods that
are used to manipulate and format string.
- Manipulation methods
Method Description
charAt() It returns the character as specified index.
Syntax:
string.charAt();
Ex:
<script>
function f1(){
var str = "Welcome to JavaScript";
var char1 = str.charAt(0);
var char2 = str[1]; //New in ES5
document.write(`Char1=${char1}<br>Char2=${char2}`)
}
f1();
</script>
charCodeAt() It returns the character code of character at specified
index. ASCII code of characters are accessed.
A=65, Z=90
indexOf() Returns the first occurrence index number of specified
characters.
lastIndexOf() Returns the last occurrence index number of specified
char.
If the character not found then both methods return “-1”.
trim() It is used to remove the leading spaces in a string.
substring() It can extract a portion of string based on specified index. It
is similar to slice but will not allow negative values.
You can access right to left by using positive value.
Ex:
<script>
function f1(){
var str = "Welcome to JavaScript";
document.write(str.substring(7,0));
}
f1();
</script>
substr() It is a legacy method, will not allow the values right to left.
slice() It is used to extract a part of string and return a new string.
Syntax:
slice(startIndex, endIndex)
slice(startIndex); slice upto end.
Slice(-1); It returns the last character.
Slice(-4); It returns the last 4 chars.
split() It splits string at specific delimiter and returns an array of
substrings.
You can also restrict the number of items to split.
Syntax:
String.split(‘delimiter’, count)
Ex:
<script>
function f1(){
var mobiles = "9876543210,9988776655,9008833113";
var numbers = mobiles.split(',', 2);
for(var number of numbers) {
document.write(number + "<br>");
}
}
f1();
</script>
startsWith() It returns true if string starts with specified chars.
endsWith() It returns true if string ends with specified chars.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>String</title>
<script>
function Verify(){
var txtEmail =
document.getElementById("txtEmail").value;
if(txtEmail.endsWith("gmail.com")) {
document.write("Your Gmail Verified..");
} else {
document.write("Only Gmail allowed");
}
}
</script>
</head>
<body>
<fieldset>
<legend>Your Email</legend>
<input type="text" id="txtEmail" placeholder="Only
Gmail Allowed">
<button onclick="Verify()">Submit</button>
</fieldset>
</body>
</html>
search() You can search for any char using a regular expression.
It returns the index number of searched string.
If character not found then it returns -1
Ex:
<script>
function f1(){
var str = "Welcome to JavaScript";
document.write(str.search(/javascript/i));
}
f1();
</script>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>String Demo</title>
<link rel="stylesheet"
href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script>
function VerifyName(){
var txtName = document.getElementById("txtName").value;
var msg = document.getElementById("msg");
var firstCharCode = txtName.charCodeAt(0);
if(firstCharCode>=65 && firstCharCode<=90) {
msg.innerHTML = "";
} else {
msg.innerHTML = "Name must start with Uppercase Letter";
}
}
function VerifyCard(){
var txtCard = document.getElementById("txtCard").value;
var firstChar = txtCard.charAt(0);
var cardLogo = document.getElementById("cardLogo");
if(firstChar=="4") {
cardLogo.src="../Images/visa.png";
} else if(firstChar=="5"){
cardLogo.src="../Images/master.png";
} else {
cardLogo.src="../Images/invalid.png";
}
}
</script>
</head>
<body class="container-fluid">
<div class="form-group">
<label>User Name</label>
<div>
<input onblur="VerifyName()" class="form-control"
placeholder="Name must start with Uppercase Letter" type="text"
id="txtName">
<div id="msg" class="text-danger"></div>
</div>
</div>
<div class="form-group">
<label>Card Number</label>
<div class="input-group">
<input onkeyup="VerifyCard()" type="text" id="txtCard" class="form-
control">
<div class="input-group-append">
<span class="input-group-text">
<img id="cardLogo" width="50" height="20">
</span>
</div>
</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>String Demo</title>
<link rel="stylesheet"
href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script>
function VerifyName(){
var txtName = document.getElementById("txtName").value;
var msg = document.getElementById("msg");
var firstCharCode = txtName.charCodeAt(0);
if(firstCharCode>=65 && firstCharCode<=90) {
msg.innerHTML = "";
} else {
msg.innerHTML = "Name must start with Uppercase Letter";
}
}
function VerifyCard(){
var txtCard = document.getElementById("txtCard").value;
var firstChar = txtCard.charAt(0);
var cardLogo = document.getElementById("cardLogo");
if(firstChar=="4") {
cardLogo.src="../Images/visa.png";
} else if(firstChar=="5"){
cardLogo.src="../Images/master.png";
} else {
cardLogo.src="../Images/invalid.png";
}
}
function VerifyEmail(){
var txtEmail = document.getElementById("txtEmail").value;
var emailError = document.getElementById("emailError");
var atPos = txtEmail.indexOf("@");
var dotPos = txtEmail.lastIndexOf(".");
if(atPos<=2 && (dotPos-atPos)<=2) {
emailError.innerHTML = "Error: @ missing or not at valid position in
email";
} else {
emailError.innerHTML = "Email Verified";
}
}
</script>
</head>
<body class="container-fluid">
<div class="form-group">
<label>User Name</label>
<div>
<input onblur="VerifyName()" class="form-control"
placeholder="Name must start with Uppercase Letter" type="text"
id="txtName">
<div id="msg" class="text-danger"></div>
</div>
</div>
<div class="form-group">
<label>Card Number</label>
<div class="input-group">
<input onkeyup="VerifyCard()" type="text" id="txtCard" class="form-
control">
<div class="input-group-append">
<span class="input-group-text">
<img id="cardLogo" width="50" height="20">
</span>
</div>
</div>
</div>
<div class="form-group">
<label>Email</label>
<div>
<input onblur="VerifyEmail()" id="txtEmail" type="text" class="form-
control">
<div id="emailError">
</div>
</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>String Demo</title>
<link rel="stylesheet"
href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script>
function VerifyName(){
var txtName = document.getElementById("txtName").value;
var msg = document.getElementById("msg");
var firstCharCode = txtName.charCodeAt(0);
if(firstCharCode>=65 && firstCharCode<=90) {
msg.innerHTML = "";
} else {
msg.innerHTML = "Name must start with Uppercase Letter";
}
}
function VerifyCard(){
var txtCard = document.getElementById("txtCard").value;
var firstChar = txtCard.charAt(0);
var cardLogo = document.getElementById("cardLogo");
if(firstChar=="4") {
cardLogo.src="../Images/visa.png";
} else if(firstChar=="5"){
cardLogo.src="../Images/master.png";
} else {
cardLogo.src="../Images/invalid.png";
}
}
function VerifyEmail(){
var txtEmail = document.getElementById("txtEmail").value;
var emailError = document.getElementById("emailError");
var atPos = txtEmail.indexOf("@");
var dotPos = txtEmail.lastIndexOf(".");
if(atPos<=2 && (dotPos-atPos)<=2) {
emailError.innerHTML = "Error: @ missing or not at valid position in
email";
} else {
emailError.innerHTML = "Email Verified";
}
}
function VerifyPassword(){
var txtPwd = document.getElementById("txtPwd").value;
var pwdError = document.getElementById("pwdError");
if(txtPwd.trim()=="john") {
pwdError.innerHTML = "Verified";
} else {
pwdError.innerHTML = "Invalid Password";
}
}
</script>
</head>
<body class="container-fluid">
<div class="form-group">
<label>User Name</label>
<div>
<input onblur="VerifyName()" class="form-control"
placeholder="Name must start with Uppercase Letter" type="text"
id="txtName">
<div id="msg" class="text-danger"></div>
</div>
</div>
<div class="form-group">
<label>Password</label>
<div>
<input onblur="VerifyPassword()" type="password" id="txtPwd"
class="form-control">
<div id="pwdError">
</div>
</div>
</div>
<div class="form-group">
<label>Card Number</label>
<div class="input-group">
<input onkeyup="VerifyCard()" type="text" id="txtCard" class="form-
control">
<div class="input-group-append">
<span class="input-group-text">
<img id="cardLogo" width="50" height="20">
</span>
</div>
</div>
</div>
<div class="form-group">
<label>Email</label>
<div>
<input onblur="VerifyEmail()" id="txtEmail" type="text" class="form-
control">
<div id="emailError">
</div>
</div>
</div>
</body>
</html>
</div>
</div>
</div>
</body>
</html>
Compare with Regular Expression:
- The function “match()” is used to verify the value with regular
expression.
- It returns true if value is matching with regular expression.
Syntax:
String.match(regularExpression); // true-false
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Verify Password</title>
<link rel="stylesheet"
href="../node_modules/bootstrap/dist/css/bootstrap.css">
<style>
progress {
height: 50px;
width: 100%;
}
</style>
<script>
function VerifyPassword(){
var regExp = /(?=.*[A-Z])\w{4,10}/;
var txtPwd = document.getElementById("txtPwd").value;
var lblMsg = document.getElementById("lblMsg");
var grade = document.getElementById("grade");
grade.style.display = "inline";
if(txtPwd.match(regExp)){
lblMsg.innerHTML="Strong Password";
GradeDisplay(1,100,100);
} else {
if(txtPwd.length<4) {
lblMsg.innerHTML="Poor Password";
GradeDisplay(1,100,20)
} else {
lblMsg.innerHTML="Weak Password";
GradeDisplay(1,100,60);
}
}
}
</script>
</head>
<body class="container-fluid">
<h2>Regular Expression</h2>
<div class="form-group">
<label>Password</label>
<div>
<input onkeyup="VerifyPassword()" id="txtPwd" type="password"
class="form-control">
<div>
<progress min="1" max="100" style="display: none;"
id="grade"></progress>
<span id="lblMsg"></span>
</div>
</div>
</div>
</body>
</html>
if(txtPwd.match(regExp)){
lblMsg.innerHTML="Strong Password".fontcolor('green').bold();
GradeDisplay(1,100,100);
} else {
if(txtPwd.length<4) {
lblMsg.innerHTML="Poor Password".fontcolor('red').italics();
GradeDisplay(1,100,20)
} else {
lblMsg.innerHTML="Weak
Password".fontcolor('yellow').bold().italics();
GradeDisplay(1,100,60);
}
}
}
</script>
</head>
<body class="container-fluid">
<h2>Regular Expression</h2>
<div class="form-group">
<label>Password</label>
<div>
<input onkeyup="VerifyPassword()" id="txtPwd" type="password"
class="form-control">
<div>
<progress min="1" max="100" style="display: none;"
id="grade"></progress>
<span id="lblMsg"></span>
</div>
</div>
</div>
</body>
</html>
Boolean Types
- Boolean types are defined by using “true or false”.
- Boolean type is used to handle decision making in programming.
- JavaScript boolean types refer to numeric value
o 0 : false
o 1 : true
- The boolean conditions in JavaScript can be configure with 0 or 1.
- JavaScript can control several HTML properties by using boolean type,
which includes checked, selected, disabled etc.
Syntax:
var x = true;
if(x==1) {
statement on true;
} else {
statement on false;
}
Ex:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script
src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
<style>
body {
background-color: darkred;
width: 90%;
}
.card {
padding: 20px;
}
</style>
<script>
function OrderClick(){
document.getElementById("lblName").innerHTML =
document.getElementById("txtName").value;
document.getElementById("lblMobile").innerHTML =
document.getElementById("txtMobile").value;
var total = 0;
if(optBurger.checked) {
mealCost = 130;
mealName = optBurger.value;
}
if(optRoller.checked) {
mealCost = 100;
mealName = optRoller.value;
}
if(optFries.checked) {
adonCost = 80;
mealCost = mealCost + adonCost;
adonName += optFries.value + "<br>";
}
if(optKrusher.checked) {
adonCost = 40;
mealCost = mealCost + adonCost;
adonName += optKrusher.value + "<br>";
}
total = mealCost;
document.getElementById("lblMeal").innerHTML = mealName;
document.getElementById("lblAdon").innerHTML = adonName;
document.getElementById("lblTotal").innerHTML= "₹" + total;
}
</script>
</head>
<body class="container-fluid">
<header>
<img src="../Images/kfctop.PNG" width="100%" height="150">
</header>
<section>
<div class="accordion" id="orderForm">
<div class="card">
<div class="card-header">
<button data-target="#customerInfo" data-toggle="collapse"
class="btn btn-danger btn-block">Customer Info</button>
</div>
<div class="collapse show" id="customerInfo" data-
parent="#orderForm">
<div class="form-group">
<label>Customer Name</label>
<div>
<input type="text" id="txtName" class="form-control">
</div>
</div>
<div class="form-group">
<label>Mobile Number</label>
<div>
<input type="text" id="txtMobile" class="form-control">
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<button data-target="#mealInfo" data-toggle="collapse" class="btn
btn-danger btn-block">Select Meal</button>
</div>
<div class="collapse" id="mealInfo" data-parent="#orderForm">
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<h3>OMG Burger</h3>
</div>
<div class="card-body">
<img src="../Images/omg1.PNG">
</div>
<div class="card-footer">
<h4>
<input name="meal" id="optBurger" value="OMG
Burger" type="radio"> ₹ 130/-
</h4>
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-header">
<h3>OMG Roller</h3>
</div>
<div class="card-body">
<img src="../Images/omg2.PNG">
</div>
<div class="card-footer">
<h4>
<input name="meal" id="optRoller" value="OMG Roller"
type="radio"> ₹ 100/-
</h4>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<button data-target="#adonInfo" data-toggle="collapse" class="btn
btn-danger btn-block">Select Ad-ON</button>
</div>
<div class="collapse" id="adonInfo" data-parent="#orderForm">
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<h3>Large Fries</h3>
</div>
<div class="card-body">
<img src="../Images/fries1.PNG">
</div>
<div class="card-footer">
<h4>
<input id="optFries" value="Large Fries"
type="checkbox"> ₹ 80/-
</h4>
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-header">
<h3>Krusher Brownie</h3>
</div>
<div class="card-body">
<img src="../Images/krusher1.PNG">
</div>
<div class="card-footer">
<h4>
<input type="checkbox" id="optKrusher" value="Krusher
Browser"> ₹ 40/-
</h4>
</div>
</div>
</div>
<button onclick="OrderClick()" data-target="#billSummary" data-
toggle="modal" class="btn btn-danger btn-block">Place Order</button>
</div>
</div>
</div>
</div>
</section>
<div class="modal fade" id="billSummary">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3>Bill Summary</h3>
<button data-dismiss="modal" class="close">x</button>
</div>
<div class="modal-body">
<table class="table table-hover">
<tbody>
<tr>
<td>Customer Name</td>
<td id="lblName"></td>
</tr>
<tr>
<td>Mobile</td>
<td id="lblMobile"></td>
</tr>
<tr>
<td>Meal Name</td>
<td id="lblMeal"></td>
</tr>
<tr>
<td>Ad-ONs</td>
<td id="lblAdon"></td>
</tr>
<tr>
<td>Total Amount</td>
<td id="lblTotal"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-
primary">OK</button>
</div>
</div>
</div>
</div>
</body>
</html>
Undefined Type
- Undefined type is configured for variables that are not defined with
value.
- Variable is defined but value is not assigned or initialized then the
compile will configure as “undefined”.
- You can verify whether value defined or not by using undefined.
Ex:
<script>
function f1(){
var x;
if(x==undefined) {
document.write("there is No value in x");
} else {
document.write(`x=${x}`);
}
}
f1();
</script>
Null Type
- Value is not defined into a reference dynamically during run time.
- Null is reference type, which indicates that value is not supplied to
variable during run time.
Ex:
<script>
function f1(){
var uname = prompt("Enter Name");
if(uname==null) {
document.write("You canceled");
} else {
document.write(`Hello ! ${uname}`);
}
}
f1();
</script>
Summary
- Number
- String
- Boolean
- Null
- Undefined
Non-Primitive Types
- The non-primitive types are “Mutable” types.
- Their reference can be changed according to state and situation.
- They don’t have fixed range of values.
- The value range varies according to the memory available.
- JavaScript non-primitive types are
o Array
o Object
o Regular Expression
Array Type
- Arrays in computer programming are used to reduce overhead and
complexity.
- JavaScript Array can store different types of values in sequential order.
- It can reduce overhead by storing values in sequential order.
- It can reduce complexity by storing multiple values under one name.
- Array size can be changed dynamically.
- Array in JavaScript have the behaviour of collections like stack, queue,
hash table.
Declaring Array:
- Array can be declared by using
o Array Meta Character “[]”
o Array Constructor “Array()”
Ex:
<script>
function f1(){
var categories = [];
var products = new Array();
}
f1();
</script>
Initialize values into Array:
<script>
function f1(){
var categories = ["Electronics","Footwear"];
var products = new Array("Speaker","Nike Causals");
}
f1();
</script>
Assign Values by using Array Property
- Property is used to map with index number in memory.
- So you can use property to access and or send value into memory.
Ex:
<script>
function f1(){
var categories = [];
categories["0"] = "Electronics";
categories["1"] = "Footwear";
for(var property in categories) {
document.write(`${property} : [${typeof property}]<br>`);
}
}
f1();
</script>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Slide Show</title>
<link rel="stylesheet"
href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../Fonts/css/all.css">
<script>
var products = ["../Images/jblspeaker.jpg", "../Images/earpods.jpg",
"../Images/shoe.jpg", "../Images/shirt.jpg"];
var productNames = ["JBL Speaker","Earpods", "Nike Casuals", "Shirt"];
function loadImage(index){
var pic = document.getElementById("pic");
pic.src= products[index];
var lblName = document.getElementById("lblName");
lblName.innerHTML = productNames[index];
}
var index = 0;
function NextClick(){
index++;
loadImage(index);
}
function PreviousClick(){
index--;
loadImage(index);
}
function SlideShow(){
var txtRange = document.getElementById("txtRange").value;
loadImage(txtRange);
}
</script>
</head>
<body class="container-fluid" onload="loadImage(0)">
<div class="card">
<div class="card-header text-center">
<h3 id="lblName"></h3>
</div>
<div class="card-body text-center">
<button onclick="PreviousClick()" class="btn btn-outline-danger">
<span><</span>
</button>
<img id="pic" width="500" height="400">
<button onclick="NextClick()" class="btn btn-outline-danger">
<span>></span>
</button>
</div>
<div class="card-footer text-center">
<input onchange="SlideShow()" class="form-control-range"
id="txtRange" type="range" min="0" value="0" max="3">
</div>
</div>
</body>
</html>
Array Manipulation
Read Array Elements:
Method Description
toString() Returns array elements separated with comma.
Ex:
<script>
function f1(){
var products = ["TV", "Mobile", "Shoe"];
document.write(products.toString());
}
f1();
</script>
join() Returns array elements separated with custom delimiter.
Ex:
<script>
function f1(){
var products = ["TV", "Mobile", "Shoe"];
document.write(products.join("-->"));
}
f1();
</script>
slice() Return array element between specified index.
Ex:
<script>
function f1(){
var products = ["TV", "Mobile", "Shoe"];
document.write(products.slice(1,2));
}
f1();
</script>
for..of It reads and return all array elements in sequential order.
Ex:
<script>
function f1(){
var products = ["TV", "Mobile", "Shoe"];
for(var item of products) {
document.write(item + "<br>");
}
}
f1();
</script>
for..in It reads and return all array properties.
Ex:
<script>
function f1(){
var products = ["TV", "Mobile", "Shoe"];
for(var item in products) {
document.write(item + "<br>");
}
}
f1();
</script>
for It uses a loop to read all elements by using initialization, condition
and counter.
Syntax:
for(initializer, condition, iterator) {
}
Ex:
<script>
function f1(){
var products = ["TV", "Mobile", "Shoe"];
for(var i=0; i<products.length; i++) {
document.write(products[i] + "<br>");
}
}
f1();
</script>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Array</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script>
var categories = ["All", "Electronics", "Footwear", "Fashion", "Accessories"];
function bodyload(){
var lstCategories = document.getElementById("lstCategories");
var optCategories = document.getElementById("optCategories");
for(var item of categories) {
var li = document.createElement("li");
li.innerHTML = item;
lstCategories.appendChild(li);
var option = document.createElement("option");
option.text = item;
option.value = item;
optCategories.appendChild(option);
}
}
</script>
</head>
<body onload="bodyload()" class="container-fluid">
<div class="form-group">
<h3>Select a Category</h3>
<ol id="lstCategories">
</ol>
</div>
<div class="form-group">
<h3>Select Category</h3>
<select class="form-control" id="optCategories">
</select>
</div>
</body>
</html>
Method Description
push() Add new elements as last item.
unshift() Add new elements as first item.
pop() Remove and return last item.
shift() Remove and return first item.
splice() It is used to add or remove item at any specific index.
Syntax:
splice(startIndex, removeCount, NewItems…)
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Array</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script>
var categories = ["All", "Electronics", "Footwear"];
function bodyload(){
var lstCategories = document.getElementById("lstCategories");
var optCategories = document.getElementById("optCategories");
lstCategories.innerHTML="";
optCategories.innerHTML="";
for(var item of categories) {
var li = document.createElement("li");
li.innerHTML = item;
lstCategories.appendChild(li);
</ol>
<div>
<button onclick="RemoveClick()">Remove</button>
</div>
</div>
<div class="form-group">
<h3>Select Category</h3>
<select size="3" class="form-control" id="optCategories">
</select>
<div>
<button onclick="RemoveSelected()">Remove Selected</button>
</div>
</div>
</body>
</html>
Searching for Elements in Array
indexOf() It can search for element in array based on given string and returns
the “index” number.
lastIndexOf() It returns the last occurrence index number.
find() It finds and returns the first occurrence element that matches the
given condition.
Ex:
<script>
function f1(){
var sales = [34500, 20000, 45000, 12000, 30000];
var result = sales.find(function(val){
return val>30000;
});
document.write(result);
}
f1();
</script>
filter() It finds and returns all elements that matches the given condition.
Ex:
<script>
function f1(){
var sales = [34500, 20000, 45000, 12000, 30000];
var result = sales.filter(function(val){
return val<=30000;
});
document.write(result.toString());
}
f1();
</script>
Ex:
<script>
function f1(){
var sales = [34500, 20000, 45000, 12000, 30000];
function search(val){
return val>=30000;
}
var result = sales.find(search);
document.write(result);
}
f1();
</script>
Sort Array Elements
FAQ:
1. What type of values we can store in array?
You can store any type of value.
2. We store function in Array?
Yes.
Ex:
<script>
function f1(){
var methods = [function(){return "Hello !"}, function(a, b){return a +
b}];
document.write(methods[0]() + "<br>");
document.write(methods[1](10,20));
}
f1();
</script>
3. What is Array Destruction?
It is a technique used to access array elements and store in individual
memory references.
Ex:
<script>
function f1(){
var methods = [function(){return "Hello !"}, function(a, b){return a +
b}];
//Without Destruction
var m1 = methods[0];
var m2 = methods[1];
document.write(m1() + "<br>");
document.write(m2(10,30) + "<br>");
// With Destruction
var [x1, x2] = methods;
document.write(x1() + "<br>");
document.write(x2(10,20));
}
f1();
</script>
4. Can we define Array inside Array [Multi Dimension]?
Yes.
Ex:
<script>
function f1(){
var values = [[10,20],["A","B"]];
document.write(values[0][1]);
}
f1();
</script>
Object Type
- Object in computer programming was introduced in early 1960’s by
“Alan Kay”.
- Object can keep all related data and functionality at one memory
reference.
- Object comprises of data and functionality.
- Object is a set of properties and methods.
}
f1();
</script>
JSON Type Data
[JavaScript Object Notation]
- It is a format for data.
- It is a collection objects.
Ex:
<script>
function f1(){
var products = [
{Name: "TV", Price: 45000.44, Cities:['Delhi', 'Hyd']},
{Name: "Mobile", Price: 12000.33, Cities: ['Hyd','Chennai']}
];
for(var product of products) {
document.write(product.Name + "-" + product.Price + "-" +
product.Cities.toString() + "<br>");
}
}
f1();
</script>
Ex: Filtering of data
<script>
function f1(){
var products = [
{Name: "TV", Price: 45000.44, Cities:['Delhi', 'Hyd'], Category:
"Electronics"},
{Name: "Mobile", Price: 12000.33, Cities: ['Hyd','Chennai'],
Category:"Electronics"},
{Name: "Nike Casuals", Price: 4000.44, Cities: ['Chennai', 'Hyd'],
Category: "Footwear"}
];
var result = products.filter(function(product){
return product.Category=="Electronics";
})
for(var item of result) {
document.write(item.Name + "-" + item.Price + "<br>");
}
}
f1();
</script>
tdName.innerHTML = item.Name;
tdPrice.innerHTML = item.Price;
tdPhoto.appendChild(pic);
tr.appendChild(tdName);
tr.appendChild(tdPrice);
tr.appendChild(tdPhoto);
tbody.appendChild(tr);
}
}
</script>
</head>
<body onload="bodyload()" class="container-fluid">
<h2>Product Details</h2>
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th>Preview</th>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</body>
</html>
</ol>
</body>
</html>
tdName.innerHTML = item.Name;
tdPrice.innerHTML = item.Price;
tr.appendChild(tdName);
tr.appendChild(tdPrice);
tbody.appendChild(tr);
}
}
function bodyload(){
LoadTable();
}
var newObject = {
Name: "",
Price: 0
};
function AddClick(){
var txtName = document.getElementById("txtName");
var txtPrice = document.getElementById("txtPrice");
newObject = {
Name: txtName.value,
Price: txtPrice.value
}
data.push(newObject);
alert("Record Added");
txtName.value="";
txtPrice.value="";
LoadTable();
}
</script>
</head>
<body onload="bodyload()" class="container-fluid">
<div class="row">
<div class="col-3">
<h3>Register Product</h3>
<div class="form-group">
<label>Name</label>
<div>
<input type="text" id="txtName" class="form-control">
</div>
</div>
<div class="form-group">
<label>Price</label>
<div>
<input type="text" id="txtPrice" class="form-control">
</div>
</div>
<div class="form-group">
<button onclick="AddClick()" class="btn btn-primary btn-
block">Add Product</button>
</div>
</div>
<div class="col-9">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
</div>
</body>
</html>
Regular Expression
- Regular expression is used to verify the format of input value.
- Expression is defined by using meta character and quantifiers enclosed
in “/ /”
- Regular expression is verified by using “match()”.
- match() is a boolean method that return true if expression is matching
with value.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Regular Expression</title>
<script>
function VerifyPassword(){
var txtPwd = document.getElementById(“txtPwd”).value;
var regExp = /(?=.*[A-Z])\w{4,10}/;
var msg = document.getElementById(“msg”);
var grade= document.getElementById(“grade”);
function ShowGrade(mn, mx, val){
grade.min = mn;
grade.max= mx;
grade.value = val;
}
if(txtPwd.match(regExp)){
msg.innerHTML=”Strong Password”.fontcolor(‘green’);
ShowGrade(1,100,100);
} else {
if(txtPwd.length<4){
msg.innerHTML=”Poor Password”.fontcolor(‘red’);
ShowGrade(1,100,20);
} else {
msg.innerHTML=”Weak Password”.fontcolor(‘orange’);
ShowGrade(1,100,70);
}
}
}
</script>
<style>
progress{
height: 20px;
width: 150px;
}
</style>
</head>
<body>
<fieldset>
<legend>Password</legend>
<div>
<input onkeyup=”VerifyPassword()” id=”txtPwd”
type=”password”>
<div>
<progress id=”grade” min=”1” value=”0”
max=”100”></progress>
</div>
<div id=”msg”></div>
</div>
</fieldset>
</body>
</html>
Ex:
<script>
function f1(){
var product = {
Name: "Samsung TV",
Price: 45000.55,
InStock: true,
Mfd: new Date("2020-03-18")
};
var months = ["January", "Feb", "March", "Apr"];
var weekdays = ["Sunday", "Monday", "Tue", "Wednesday", "Thu"];
document.write(`Name=${product.Name}<br>Price=${product.Price}<br>InSto
ck=${product.InStock}<br>
Manufactured Month: ${months[product.Mfd.getMonth()]} <br>
Manufactured Weekday: ${weekdays[product.Mfd.getDay()]} <br>
Manufactured Date: ${product.Mfd.getDate()} <br>
Manufactured Year: ${product.Mfd.getFullYear()}<br>
Date: ${product.Mfd.toLocaleDateString()}
`);
}
f1();
</script>
- You can set date dynamically by using “set” methods.
o setMonth()
o setDate()
o setFullYear()
o setHours()
o setMinutes()
o setSeconds()
o setMilliseconds()
Ex:
<script>
function f1(){
var product = {
Name: "Samsung TV",
Price: 45000.55,
InStock: true,
Mfd: new Date("2020-03-18")
};
var months = ["January", "Feb", "March", "Apr"];
var weekdays = ["Sunday", "Monday", "Tue", "Wednesday", "Thu"];
product.Mfd.setFullYear(2021);
product.Mfd.setMonth(1);
document.write(`Name=${product.Name}<br>Price=${product.Price}<br>InSto
ck=${product.InStock}<br>
Manufactured Month: ${months[product.Mfd.getMonth()]} <br>
Manufactured Weekday: ${weekdays[product.Mfd.getDay()]} <br>
Manufactured Date: ${product.Mfd.getDate()} <br>
Manufactured Year: ${product.Mfd.getFullYear()}<br>
Date: ${product.Mfd.toLocaleDateString()}
`);
}
f1();
</script>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Date</title>
<style>
.container{
width: 600px;
height: 400px;
justify-content: center;
align-items: center;
margin:auto;
}
</style>
<script>
function bodyload(){
var now = new Date();
var hrs = now.getHours();
var pic = document.getElementById("pic");
if(hrs>=00 && hrs<=12) {
pic.src="../Images/morning.gif";
} else if(hrs>12 && hrs<=17) {
pic.src="../Images/afternoon.gif";
} else {
pic.src="../Images/evening.gif";
}
}
</script>
</head>
<body onload="bodyload()">
<div class="container">
<img id="pic" width="300" height="300">
</div>
</body>
</html>
Summary
- Primitive Types
o Number
o String
o Boolean
o Null
o Undefined
- Non-Primitive Types
o Array
o Object
o Regular Expression
o Date
JavaScript Operators and Expressions
- Operator is an object that evaluates a value.
- Based on what type of value an operator evaluates the operators are
classified into following types:
o Arithmetic Operators
o Logical Operators
o Comparison Operators
o Assignment Operators
o Special Operators
- Operators are also classed into 3 type based on the number of operands
they can handle.
o Unary : One Operand [x++]
o Binary : Two operands [x + y]
o Ternary : Three operands [ (condition)?true:false]
Arithmetic Operators:
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus division
** Exponent [new in ES5] [old version – Math.pow()]
++ Increment
-- Decrement
Ex:
<script>
function f1(){
var x = 2;
var y = 3;
document.write(`x**y=${x**y} <br>`);
document.write(`Power=${Math.pow(x,y)}`);
}
f1();
</script>
Bootstrap 5
- Open Terminal
- Install following libraries
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
</head>
<body>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Containers
.container
.container-fluid
.container-sm
.container-lg
.container-xl
.container-xxl
.m margin
.p padding
Directions
t top
b bottom
s left
e right
Sizes
1 to 5
Ex:
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
</head>
<body>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Syntax:
.bg-danger
.bg-warning
.bg-info
.text-primary
.text-secondary
.text-danger
Ex:
<div class="container-fluid">
</div>
Border
.border
.border-top
.border-end
.border-start
.border-bottom
Remove Border
Border Color
Border Width
.border-1 to 5 width
Border Radius
.rounded
.rounded-top
.rounded-bottom
.rounded-start
.rounded-end
.rounded-circle
.rounded-pill
Ex:
<div class="mt-3">
</div>
.w for width
.h for height
Size
0 0%
25 25%
50 50%
75 75%
100 100%
Syntax:
Ex:
</div>
Display
.d for display
.d-{value}
Display Values
- None
- Inline
- Block
- Grid
- Flex
Syntax:
.d-block
.d-grid
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
</head>
<body class="container-fluid">
<li class="me-3">Home</li>
<li class="me-3">About</li>
<li class="me-3">Contact</li>
</ul>
Block-1
</div>
Block-2
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Position
.position-static
.position-relative
.position-absolute
.position-fixed
.position-sticky
.top
.start
.end
.bottom
1 at 0
50 at 50
100 at 100
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
</head>
<body class="container-fluid">
<div class="mt-4">
<button class="position-relative">
</button>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
.row
.cols
.cols-1 to 12
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
</head>
<body class="container-fluid">
<div class="col">
</div>
</div>
<div class="col-2">
<ul>
<li>Home</li>
<li>Electronics</li>
<li>Footwear</li>
</ul>
</div>
<div class="col-8">
<h2>Home Page</h2>
</div>
<div class="col-2">
<h3>Ads..</h3>
</div>
</div>
<div class="row">
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Ex:
<dl class="row">
<dt class="col-2">Name</dt>
<dt class="col-2">Price</dt>
<dd class="col-10">56000.55</dd>
<dt class="col-2">Stock</dt>
<dd class="col-10">Available</dd>
</dl>
Bootstrap Components
Alerts
.alert
.alert-link
.alert.dismissible
<!DOCTYPE html>
<html>
<head>
<title>Alerts</title>
</head>
<body class="container-fluid">
<h2>Alerts</h2>
<h2>Delete Record</h2>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Buttons
.btn
.btn-close
.btn-sm, lg,
.btn-toolbar
.btn-group
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Alerts</title>
</head>
<body class="container-fluid">
<h2>Buttons</h2>
<h2>Outline Button</h2>
<h2>Button Group</h2>
<div class="btn-group">
</div>
<h2>Button Toolbar</h2>
<div class="btn-group">
</div>
<div class="btn-group">
</div>
</div>
<h2>Block Button</h2>
<div class="d-grid">
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Badge
.badge
.rounded-pill
.bg-contextual
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Alerts</title>
</head>
<body class="container-fluid">
<h2>Badge</h2>
</button>
<h2>Badge Position</h2>
</button>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Cards
.card-group
.card
.card-header
.card-footer
.card-body
.card-img-top
.card-img-overlay
.card-title
.card-text
.card-link
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Alerts</title>
</head>
<body class="container-fluid">
<h2>Products Catalog</h2>
<div class="card-header">
</div>
<div class="card-body">
</div>
Add to Cart
</button>
</div>
</div>
<div class="card-header">
</div>
<div class="card-body">
</div>
Add to Cart
</button>
</div>
</div>
<div class="card-header">
<h3 class="card-title">Shirt</h3>
</div>
<div class="card-body">
</div>
Add to Cart
</button>
</div>
</div>
<h3 class="card-title">Shirt</h3>
</div>
Add to Cart
</button>
</div>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Carousel
.carousel
.carousel-dark
.carousel-inner
.carousel-item
.slide
.carousel-fade
.carousel-control-prev
.carousel-control-prev-icon
.carousel-control-next
.carousel-control-next-icon
.carousel-indicators
Attributes
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Alerts</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
</head>
<body class="container-fluid">
<div class="carousel-inner">
</div>
<div class="carousel-item">
</div>
<div class="carousel-item">
</div>
</div>
<span class="carousel-control-prev-icon"></span>
</button>
<span class="carousel-control-next-icon"></span>
</button>
<div class="carousel-indicators">
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Collapse
.collapse
.show
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Alerts</title>
</head>
<body class="container-fluid">
<div class="mt-4">
<dl>
<dt>Name</dt>
<dd>Nike Causals</dd>
<dt>Photo</dt>
<dd>
</dd>
</dl>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Accordion
.accordion
.accordion-item
.accordion-header
.accordion-button
.accordion-body
.accordion-collapse
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Alerts</title>
</head>
<body class="container-fluid">
<h2>Table of Contents</h2>
<div class="accordion-item">
HTML Tutorial
</button>
</h2>
<div class="accordion-body">
<ul>
<li>Normal Elements</li>
<li>Void Elements</li>
</ul>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
CSS Examples
</button>
</h2>
<div class="accordion-body">
<ul>
<li>Transions</li>
<li>Transforms</li>
<li>Responsive Design</li>
<li>Animations</li>
</ul>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
JavaScript Tutorial
</button>
</h2>
<div class="accordion-body">
<ul>
<li>Variables</li>
<li>Data Types</li>
<li>Operators</li>
<li>Statements</li>
</ul>
</div>
</div>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Forms
.form-control : textbox, email, number, textarea, data elements related to string and
number input.
.form-select : dropdown
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
</head>
<body class="container-fluid">
<form class="w-25">
<h3>Register Product</h3>
<div>
<div>
</div>
</div>
<div class="mt-2">
<label class="form-label">Price</label>
<div>
</div>
</div>
<div class="mt-2">
<label class="form-label">Qty</label>
<div>
</div>
<div class="mt-2">
<div>
<select class="form-select">
<option>Delhi</option>
<option>Hyd</option>
</select>
</div>
</div>
<div class="mt-2">
</div>
</div>
<div class="mt-2">
<div>
</div>
</div>
<div class="mt-2">
<div>
</div>
</div>
</div>
</form>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Input Group
.input-group
.input-group-text
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
</head>
<body class="container-fluid">
<select class="input-group-text">
<option>All</option>
<option>Electronics</option>
<option>Footwear</option>
</select>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
<span class="input-group-text">₹</span>
<span class="input-group-text">.00</span>
</div>
Ex:
</div>
</div>
Modal
.modal
.modal-dialog
.modal-content
.modal-header
.modal-footer
.modal-dialog-center
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
</head>
<body class="container-fluid">
<div class="mt-3">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2>Sign-In</h2>
<button class="btn-close"></button>
</div>
<div class='modal-body'>
<dl>
<dt>User Name</dt>
</dl>
</div>
</div>
</div>
</div>
<div class="modal show fade" id="register">
<div class="modal-content">
<h2>Register User</h2>
</div>
<div class="modal-body">
<dl>
<dt>User Name</dt>
<dt>Password</dt>
<dt>User Name</dt>
<dt>Password</dt>
<dt>User Name</dt>
<dt>Password</dt>
<dt>User Name</dt>
<dt>Password</dt>
</dl>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Images
.img-fluid
.img-thumbnail
Ex:
<div class="mt-2">
</div>
Tables
.table
.table-hover
.table-bordered
.table-borderless
.table-stripped
.table-responsive
.caption-top
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
</head>
<body class="container-fluid">
<div class="mt-2">
<h2>Products List</h2>
<div class="table-responsive">
<thead>
<tr>
<th>Product Id</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
<td>1</td>
<td>Samsung TV</td>
<td>46000.55</td>
</tr>
<tr>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
<td>2</td>
<td>Mobile</td>
<td>16000.55</td>
</tr>
<tr>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
<td>3</td>
<td>Nike Casual</td>
<td>6000.55</td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Dropdown List
.dropdown
.dropdown-item
.dropup
.dropend [right]
.dropstart [left]
.active
.disabled
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
</head>
<body class="container-fluid">
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.
</p>
<div class="dropdown">
More
</button>
<ul class="dropdown-menu">
<li class="dropdown-divider"></li>
<li class="dropdown-item">
Categories
</a>
</div>
</li>
</ul>
</div>
</div>
<p>Depending on how you obtained the Windows software, this is a license agreement between
(i) you and the device manufacturer or software installer that distributes the software with your
device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business, where
your principal place of business is located, one of its affiliates) if you acquired the software from a
retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.
</p>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
.nav
.nav-item
.nav-link
.nav-tabs
.nav-pills
.tab-content
.tab-pane
.fade
.show
.active
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
</head>
<body class="container-fluid">
<div class="mt-3">
<nav>
</div>
</nav>
<dl>
<dt>Name</dt>
<dd>JBL Speaker</dd>
<dt>Price</dt>
<dd>5600.55</dd>
<dt>Stock</dt>
<dd>Avilable
</dl>
</div>
</div>
</div>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Navbar
.navbar
.navbar-expand {sm-md-lg-xl-xxl}
.navbar-brand
.navbar-nav
.navbar-toggler
.navbar-toggler-icon
.navbar-collapse
.navbar-light
.navbar-dark
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
</head>
<body class="container-fluid">
<div class="container-fluid">
<span class="navbar-toggler-icon"></span>
</button>
<li class="nav-item">
<a class="nav-link">Home</a>
</li>
<li class="nav-item">
<a class="nav-link">Electronics</a>
</li>
<li class="nav-item">
<a class="nav-link">Footwear</a>
</li>
<li class="nav-item">
<a class="nav-link">Fashion</a>
</li>
</ul>
<form class="d-flex">
</form>
</div>
</div>
</nav>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
List Group
.list-group
.list-group-item
.list-unstyled
.list-group-flush
.list-group-numbered
.list-group-horizontal
<li class="list-group-item">Item-1</li>
<li class="list-group-item">Item-2</li>
<li class="list-group-item">Item-3</li>
<li class="list-group-item">Item-4</li>
</ul>
Pagination
.pagination {sm | lg }
.page-item
.page-link
Ex:
</ul>
Progress
.progress
.progress-bar
.progress-bar-stripped
.progress-bar-animated
Ex:
<div class="mt-3">
<div class="progress">
40% Completed
</div>
60% Remaining
</div>
</div>
</div>
Spinners
.spinner-border
.spinner-grow
Ex:
<div class="mt-3">
</button>
</button>
</div>
Scrollspy
Data-bs-spy
Data-bs-offset
Tabindex
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
</head>
<body class="container-fluid">
<div class="row">
<div class="col-3">
</div>
</div>
<div class="col-9">
<h3 id="html">HTML</h3>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<h3 id="js">JavaScript</h3>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<h3 id="jq">jQuery</h3>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
<p>Depending on how you obtained the Windows software, this is a license agreement
between (i) you and the device manufacturer or software installer that distributes the software with
your device; or (ii) you and Microsoft Corporation (or, based on where you live or, if a business,
where your principal place of business is located, one of its affiliates) if you acquired the software
from a retailer. Microsoft is the device manufacturer for devices produced by Microsoft or one of its
affiliates, and Microsoft is the retailer if you acquired the software directly from Microsoft. Note that
if you are a volume license customer, use of this software is subject to your volume license
agreement rather than this agreement.</p>
</div>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>