Styles Introduction
Styles Introduction
- Styles are attributes defined for HTML elements to make them more interactive and
responsive.
1. Inline Styles
2. Embedded Styles
3. External Style Sheet
[CSS - Cascade Style Sheet]
Inline Styles:
==========
- Styles are defined for every element individually.
Syntax:
<h2 style="attribute:value; attribute:value">
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
</head>
<body>
<h1 style="background-color: red;color:white; text-align: center;">HTML</h1>
<h1>CSS</h1>
<h1>JavaScript</h1>
</body>
</html>
Embedded Styles:
==============
- Styles are defined for elements in a separate <style> container.
- Clean separation of design and effects.
- Easy to extend.
- Easy to reuse.
- They are slower that inline.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
h1 {
background-color: blue;
color:white;
text-align: center;
}
</style>
</head>
<body>
<h1>HTML</h1>
<h1>CSS</h1>
<h1>JavaScript</h1>
</body>
</html>
- You have to define the MIME type of styles when you embed in a page.
<style type="text/css">
</style>
Syntax:
<style type="text/css" media="screen|print|speech">
</style>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style type="text/css" media="screen">
h1 {
background-color: blue;
color:white;
text-align: center;
}
</style>
<style type="text/css" media="print">
h1 {
background-color: black;
color:white;
text-align: left;
}
#js {
display: none;
}
</style>
</head>
<body>
<h1>HTML</h1>
<h1>CSS</h1>
<h1 id="js">JavaScript</h1>
</body>
</html>
Styles in External Files:
==================
- You can configure styles in a separate style sheet.
- Style sheet have extention ".css"
- Style sheet can cascade, so that you can access and use style across several pages.
- You can reuse across multiple pages.
- It increases the number of requests for page and also page load time.
Ex:
1. Goto "src/styles" folder
2. add a new file
effects.css
h1 {
background-color: green;
color:white;
text-align: center;
}
3. Link to your HTML page
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<link rel="stylesheet" href="../src/styles/effects.css">
</head>
<body>
<h1>HTML</h1>
<h1>CSS</h1>
<h1>JavaScript</h1>
</body>
</html>
Syntax:
<link rel="stylesheet" href="path" type="text/css" media="print">
Syntax:
<link rel="stylesheet" href="http://127.0.0.1/cdn/effects.css">
Minification
=========
- It is a coding technique used by developers to reduce the size of file.
- It is not ZIP or RAR, It is a coding technique.
Development Code:
if (condition )
{
statement_if_true;
}
else
{
statement_if_false;
}
Production Code: [Minified]
(condition) ? statement_if_true : statement_if_false;
- You can Minify the CSS files by using various software tools. You have to use the minified
files for production.
Ex:
1. Create a new CSS file
"effects.css"
h1 {
background-color: green;
color:white;
text-align: center;
}
Summary:
1. Inline
2. Embedded
3. External File
FAQ:
1. If effects are defined in external style sheet, embedded and inline, which effect will
apply to content?
A.
- If same effects are written then
Priority
1st Inline
2nd Embedded
3rd External file
- If different effects are written then all will apply
Selector
{
attribute:value;
attribute:value;
}
CSS Selector
==========
- Selector defines where to apply the given set of effects.
- The primary selectors used in CSS.
1. Type Selector
2. ID Selector
3. Class Selector
Type Selector:
- It uses the token name to apply effects.
- The effects are applied at every location where the tag is used.
- You can't ignore for any specific tag.
Syntax:
h1, p, div, span, table, td {
attribute: value;
}
ID Selector:
- Id selector is defined by using "#"
- It is accessed by using "id" attribute.
- You can apply only to the element your require.
Syntax:
#heading {
<h2 id="heading">
<div id="heading">
- Every element can have only one ID.
- You can't apply multiple categories of styles to one element.
Class Selector
===========
- It is defined by using "."
- It is accessed by using "class" attribute.
- Every element can implement multiple classes.
Syntax:
.class1-name { }
.class2-name { }
FAQ: IF all selectors are defined for any specific element then what is the
priority?
Ans:
1st ID Selector
2nd Class Selector
3rd Type Selector
#name, p {
color:red;
}
<h2 id="name">
<p>
.className, #id, p {
- The CSS selectors are further classified into various groups based on their
behaviour.
Child Selector
Decendent
Adjacent Sibling
General Sibling
Child Selector:
It applies effects to all child elements present within the specific parent.
parent child {
}
It will apply effects for element present at any level of hierarchy.
Decendent Selector:
It applies effects only to direct child elements. Not to all levels of hierarchy.
Adjacent Siblings
It defines effects to adjacent element, i.e the element that comes after the specified
element. [Only to First One]
element1 + element2
{
}
General Siblings
It defines effects to all adjacent elements.
element1 ~ element2
{
}
Note: Rational selectors and combinators are based on parent and child or element
and its adjacent.
2. Attribute Selectors
These are used to apply effects based on the attribute defined for element.
element[attribute=value]
{
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
p::selection {
background-color: yellow;
}
</style>
</head>
<body>
<p>
Your use of this software is subject to the terms and conditions of the license agreement
by which you acquired this software. If you are a volume license customer, use of this
software is subject to your volume license agreement. You may not use this software if you
have not validly acquired a license for the software from Microsoft or its licensed distributors.
</p>
</body>
</html>
EX:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
p::selection {
background-color: yellow;
}
</style>
</head>
<body>
<p>
Your use of this software is subject to the terms and conditions of the license agreement
by which you acquired this software. If you are a volume license customer, use of this
software is subject to your volume license agreement. You may not use this software if you
have not validly acquired a license for the software from Microsoft or its licensed distributors.
</p>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
p::first-letter {
font-size: 30px;
font-weight: bold;
font-family: Arial;
float:left;
}
p::first-line {
color:blue;
}
</style>
</head>
<body>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.</p>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
td:empty {
background-color: lightcoral;
}
</style>
</head>
<body>
<table border="1" width="400">
<tr>
<th>Name</td>
<th>Price</td>
</tr>
<tr>
<td>TV</td>
<td>60000.44</td>
</tr>
<tr>
<td>Mobile</td>
<td></td>
</tr>
</table>
</body>
</html>
Summary:
1. How to define styles in HTML page?
2. What is Minification?
3. How to target various media devices?
4. Rules of CSS
5. Selectors
CSS Colors
=========
- CSS allows colors by
a) Color Name
b) Hexa decimal code
c) rgb()
d) rgba()
e) hsl()
Hexa Decimal: Hexa code uses 3 & 6 char code with "#"
#RGB
#RRGGBB
Range of color : 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
0 = dark
f = bright
rgba() : RGB method with color range from 0 to 255.
Alpha range from 0 to 1.
color : rgb(0,0,255,0.4);
Gradient Colors
- A combination of multiple colors with specific orentation.
a) linear gradient
b) radial gradient
Note: You can apply gradients only as image, not as a color value.
Syntax:
{
background-image: linear-gradient(direction, colors);
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container {
width: 600px;
height: 300px;
border:2px solid black;
background-image: linear-gradient(to top right, rgb(243, 170, 170), yellow 30%,
green);
}
</style>
</head>
<body>
<div id="container">
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
body {
background-image: url("images/netflixback.jpg");
}
#container {
height: 700px;
width: 100%;
background-image: radial-gradient(rgba(255,255,255,0.3),rgba(0,0,0,1));
}
</style>
</head>
<body>
<div id="container">
</div>
</body>
</html>
CSS Inheritance and Box Model
CSS Units
========
1. Absolute Units
px - Pixel for screen
in - Media is Printer
cm
pt
% - Responsive 50%
2. Relative Units
em - parent element
rem - root element
Syntax:
#container {
font-size: 30px; // absolute
}
p{
font-size: 0.5em; // relative to container [15px]
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container {
font-size: 30px;
}
p{
font-size: 0.5em;
}
</style>
</head>
<body>
<div id="container">
Web Techologies
<p>Styles in HTML</p>
</div>
</body>
</html>
CSS Inheritance
==============
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container {
font-size: 30px;
font-family: Arial;
color:red;
border:2px solid red;
padding:20px;
}
p{
font-size: 0.5em;
color:initial;
}
</style>
</head>
<body>
<div id="container">
Web Techologies
<p>Styles in HTML</p>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container {
font-size: 30px;
font-family: Arial;
color:red;
border:2px solid red;
padding:20px;
}
p{
color: initial;
font-size: initial;
border:inherit;
padding: inherit;
}
</style>
</head>
<body>
<div id="container">
Web Techologies
<p>Styles in HTML</p>
</div>
</body>
</html>
Padding: It sets space between the border and content inside container.
padding
padding-left
padding-right
padding-top
padding-bottom
border-left-size
border-left-style
border-left-color
border-left : short hand [size, style, color]
Positions
Display
CSS Positions and Inde
CSS Box Model
- Border
- Padding
- Margin
- Width
- Height
CSS Positions
===========
1. Static
2. Relative
3. Absolute
4. Fixed
5. Sticky
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container {
border:1px solid black;
}
#offer {
width: 80px;
border:1px dotted red;
position: static;
right: 100px;
}
</style>
</head>
<body>
<div id="container">
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
<div id="offer">
50% OFF
</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container {
border:1px solid black;
}
#offer {
width: 80px;
border:1px dotted red;
position: absolute;
right: 10px;
top: 50px;
background-color: red;
color:white;
}
</style>
</head>
<body>
<div id="container">
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
<div id="offer">
50% OFF
</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container {
border:1px solid black;
}
#offer {
width: 80px;
border:1px dotted red;
position: fixed;
right: 10px;
top: 50px;
background-color: red;
color:white;
}
</style>
</head>
<body>
<div id="container">
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
<div id="offer">
50% OFF
</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container {
border:1px solid black;
}
#offer {
width: 80px;
border:1px dotted red;
position: sticky;
right: 10px;
top: 50px;
background-color: red;
color:white;
}
</style>
</head>
<body>
<div id="container">
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
<div id="offer">
50% OFF
</div>
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
</div>
</body>
</html>
Note: Specifying left, right, top and bottom will be relative to parent content not to page.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
div {
border:1px solid red;
}
#parent {
height: 300px;
width: 600px;
position: static;
margin-left: 200px;
}
#child {
height: 100px;
width: 150px;
position: relative;
left: 50px;
}
</style>
</head>
<body>
<div id="parent">
parent container
<div id="child">
child container
</div>
</div>
</body>
</html>
CSS Z-Index
==========
- Z Index is used to arrange elements stack.
- Stack overlaps elements.
- You can bring forward or send backward by using z-index
- It uses the values starting for 0 level.
0 - absolute back
1,2,3,4.. - from back to front
Syntax:
element1 {
z-index: 0;
}
element2 {
z-index:2;
}
element3 {
z-index:1;
}
CSS Float
========
- It controls the element position directly relative to adjacent elements by keep float ing to left
or right.
- It can also control the floating of content by using "clear", which clears the float attribute.
[As float attribute continous for rest of adjacent elements].
- Clear is defined by using dynamic property.
Syntax:
element {
float : left;
}
<element to float>
<your content>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#kids {
float: right;
margin-left: 100px;
}
div {
background-color: black;
height: 400px;
color:white;
font-family: Arial;
padding: 20px;
}
h1,h2 {
padding-top: 30px;
padding-right: 20px;
}
</style>
</head>
<body>
<div>
<img id="kids" src="../public/images/kids.png" width="200" height="200">
<div id="title">
<h1>Create profiles for children.</h1>
<h4>Send children on adventures with their favourite characters in a space made
just for them—free with your membership.</h4>
</div>
</div>
</body>
</html>
Display
- flex
- inline
- grid
Display CSS
CSS Clear
- It is used to clear floating attribute that spans after specified elements.
- You can configure clear : both, left, right
Syntax:
element1 {
float : left;
}
element2 {
clear: left;
}
CSS Display
=========
- It controls the display style of elements
flex
grid
inline
block
none
- display:none will hide element in page.
- display:block will display elements in block style [new line]
- display:inline will display elements in same line. [side-by-side]
- display:flex will display elements inline with fluid container.
- display:grid will display elements in grid style, which contains
rows and columns.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
#container div {
display: inline;
}
</style>
</head>
<body>
<div id="container">
<div>
<input type="text" placeholder="User Name">
</div>
<div>
<input type="password" placeholder="Password">
</div>
<div>
<button>Register</button>
</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
.container div {
border : 1px solid black;
padding: 5px;
width: 100px;
height: 100px;
}
.container {
display: flex;
flex-wrap: wrap;
}
</style>
</head>
<body>
<div class="container">
<div>Box-1</div>
<div>Box-2</div>
<div>Box-3</div>
<div>Box-4</div>
<div>Box-5</div>
<div>Box-6</div>
<div>Box-7</div>
<div>Box-8</div>
<div>Box-9</div>
<div>Box-10</div>
<div>Box-11</div>
<div>Box-12</div>
<div>Box-13</div>
<div>Box-14</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
.container div {
border : 1px solid black;
padding: 5px;
width: 100px;
height: 100px;
}
.container {
display: flex;
flex-wrap: wrap;
flex-direction: column-reverse;
}
</style>
</head>
<body>
<div class="container">
<div>Box-1</div>
<div>Box-2</div>
<div>Box-3</div>
<div>Box-4</div>
<div>Box-5</div>
<div>Box-6</div>
<div>Box-7</div>
<div>Box-8</div>
<div>Box-9</div>
<div>Box-10</div>
<div>Box-11</div>
<div>Box-12</div>
<div>Box-13</div>
<div>Box-14</div>
<div>You got a mail</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
.container div {
border : 1px solid black;
padding: 5px;
width: 100px;
height: 100px;
margin: 10px;
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
height: 700px;
border:2px solid red;
align-items: center;
}
nav {
background-color: black;
color:white;
padding: 10px;
display: flex;
justify-content: space-between;
}
</style>
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body>
<nav>
<div>Amazon Shopping</div>
<div>
<input type="text" size="40">
<button><span class="bi bi-search"></span></button>
</div>
<div>
<select>
<option>Country</option>
<option>India</option>
<option>US</option>
</select>
<button>Signin</button>
</div>
</nav>
<div class="container">
<div>Box-1</div>
<div>Box-2</div>
<div>Box-3</div>
<div>Box-4</div>
<div>Box-5</div>
<div>Box-6</div>
<div>Box-7</div>
<div>Box-8</div>
<div>Box-9</div>
<div>Box-10</div>
<div>Box-11</div>
<div>Box-12</div>
<div>Box-13</div>
<div>Box-14</div>
<div>You got a mail</div>
</div>
</body>
</html>
Ex: Horizontal and Vertical Center
{
display : flex;
justify-content:center;
align-items:center; [requires height]
}
<!DOCTYPE html>
<html>
<head>
<title>Styles</title>
<style>
body {
background-color: black;
color:white;
font-family: Arial;
background-attachment: fixed;
}
.main-content {
width: 550px;
text-align: center;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 600px;
}
input, button {
height: 40px;
}
button {
background-color: red;
color:white;
border:none;
}
.opaque {
background-color: rgba(0,0,0,0.6);
margin-left: -30px;
margin-right: -30px;
margin-top: -30px;
}
</style>
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body background="../public/images/netflixback.jpg">
<div class="opaque">
<div class="container">
<div class="main-content">
<h1> Unlimited movies, TV shows and more.</h1>
<h2> Watch anywhere. Cancel anytime.</h2>
<p>Ready to watch? Enter your email to create or restart your membership.</p>
<p>
<input type="email" size="50" placeholder="Your email address">
<button>Get Started <span class="bi bi-chevron-right"></span> </button>
</p>
</div>
</div>
</div>
</body>
</html>
Display Grid
==========
- Display grid allows to arrange your content into specific row and column.
- Display grid is a fluid grid that splits content using
"grid-template-columns"
- You can arrange content into specific row and column by using
a) grid-row
b) grid-column
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
.container {
display: grid;
grid-template-columns: 3fr 6fr 3fr;
}
header, footer {
background-color: red;
color:white;
}
nav {
background-color: yellow;
}
aside {
background-color: blue;
color:white;
}
header {
grid-row: 1;
grid-column: 1/4;
}
section {
grid-row: 2;
grid-column: 1/4;
height: 300px;
display: grid;
}
footer {
grid-row: 3;
grid-column: 1/4;
}
aside {
grid-row: 2;
grid-column: 3;
}
main {
grid-row: 2;
grid-column: 2;
}
nav {
grid-row: 2;
grid-column: 1;
}
</style>
</head>
<body>
<div class="container">
<header>
Amazon Shopping
</header>
<section>
<nav>
<ol>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ol>
</nav>
<main>
shopping main content
</main>
<aside>
ads..
</aside>
</section>
<footer>
© copyright 2022
</footer>
</div>
</body>
</html>
CSS Text Effects and Backgrounds
Display
- inline
- none
- block
- grid
- flex
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
header, footer, section {
border:1px solid black;
}
article {
width: 80px;
background-color: red;
color:white;
grid-row: 1;
grid-column: 1;
}
.container {
display: grid;
grid-template-columns: 3fr 6fr 3fr;
}
header {
grid-row: 1;
grid-column: 2/4;
}
section {
grid-row :2;
grid-column: 2/4;
}
footer {
grid-row:3;
grid-column: 2/4;
}
</style>
</head>
<body>
<div class="container">
<header>
Header
</header>
<section>
<nav>
navigation
</nav>
<main>
main
</main>
<aside>
ads..
</aside>
</section>
<footer>
footer
</footer>
<article>
70% Off
</article>
</div>
</body>
</html>
CSS Columns
===========
- Columns are used to arrange contineous content from left to right.
- The contents will span automatically to next column.
Note: Columns always adjust according to content and width. Hence if your defined
gap, better not to define width.
Syntax:
container {
columns : 4;
column-gap: 30px;
column-rule: 2px solid red;
}
- Columns allow merging of content that can span into all columns. You can't define
specific set of columns.
Syntax:
h2 {
column-span: all;
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
header {
font-size: 60px;
font-weight: bold;
text-align: center;
}
p{
text-align: justify;
}
.container {
columns: 6;
column-gap: 30px;
column-rule: 2px dotted black;
}
h2 {
column-span: all;
background-color: black;
color:white;
text-align: center;
}
</style>
</head>
<body>
<header>
THE HINDU
</header>
<div class="container">
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<h2>India's Largest News Paper</h2>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.</p>
</div>
</body>
</html>
CSS Background
=============
- background : short hand for all attributes
- background-color : sets specific color
- background-image : sets background image using "url()"
- background-size : sets the width and height of image.
[in pixels, percent, cover, contain]
- background-position : sets the position along x and y axis.
- background-attachment : controls the scrolling of background
[fixed | scroll]
- background-repeat : It controls repeating of image
- repeat
- no-repeat
- repeat-x
- repeat-y
Syntax:
background-position: left | center | right -- horizontal
top | center | bottom -- vertical
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
body {
background-image: url("../public/images/netflixback.jpg");
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
height: 600px;
color:white;
}
</style>
</head>
<body>
<div class="container">
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
</div>
</body>
</html>
Syntax:
body {
background-image: url(), url();
background-position: firstImage, secondImage;
background-repeat : firstImage, secondImage;
background-size : firstImage, secondImage;
background-attachment: firstImage, secondImage;
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
body {
background-image: url("../public/images/shoe.jpg"),
url("../public//images/border.png");
background-size: 200px 200px, 200px 200px;
background-repeat: no-repeat, repeat;
background-position: center center;
height: 500px;
background-attachment:fixed, scroll;
}
</style>
</head>
<body>
<div class="container">
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
</div>
</body>
</html>
Syntax:
@media screen and (orientation:landscape)
{
body {
}
}
@media screen and (orientation:portrait)
{
body {
}
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
@media screen and (orientation:landscape) {
body {
background-image: url("../public/images/netflixback.jpg");
background-size: cover;
background-repeat: repeat-x;
}
}
@media screen and (orientation:portrait) {
body {
background-image: url("../public/images/banner.png");
background-size: cover;
background-repeat: repeat-y;
}
}
</style>
</head>
<body>
<div class="container">
</div>
</body>
</html>
Text Effects:
CSS 2D and 3D
Animations
Bootstrap
CSS Text and 2D
CSS Fonts
font-family
font-size
font-weight
font-style
font-variant
text-decoration
- style : dotted, dashed, wavy etc..
- size : thickness
- color : any color
- type : underline, overline, linethrough
Syntax:
h2 {
text-decoration: underline wavy 20px red;
}
text-align
- center, left, right, justify
- horizontal alignment
Syntax:
h2 {
text-align :center;
}
text-transform:
- uppercase, lowercase, capitalize
Syntax:
h2{
text-transform : uppercase;
}
text-shadow:
- it is similar to box shadow.
- 4 values [horizontal, vertical, blur, color]
Syntax:
h2 {
text-shadow: 3px 3px 4px red;
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
h1 {
text-align: center;
font-size: 120px;
text-transform: uppercase;
text-shadow: 10px 5px 8px black;
color:yellow;
}
</style>
</head>
<body>
<h1>welcome to css</h1>
</body>
</html>
CSS Spacing
==========
letter-spacing set space between chars
word-spacing set space between words
line-height set space between line
word-break sets word break for lengthy words in container.
white-space control the wrapping of text
text-overflow controls the overflow of text in container.
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
h1 {
text-align: center;
font-size: 80px;
text-transform: uppercase;
text-shadow: 10px 5px 8px black;
color:yellow;
word-spacing: 50px;
letter-spacing: 30px;
}
p{
line-height: 50px;
}
</style>
</head>
<body>
<h1>welcome to css</h1>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license
customer, use of this software is subject to your volume license agreement. You may
not use this software if you have not validly acquired a license for the software from
Microsoft or its licensed distributors.
</p>
</body>
</html>
Syntax
p{
word-break : break-all;
}
Syntax:
p{
border: 2px solid black;
width : 245px;
height: 50px;
white-space: nowrap;
overflow:hidden;
text-overflow: ellipsis;
}
CSS 2D Transforms
===============
- Transform is the process of changing from existing state of element to a new state.
- CSS can transform element
a) position
b) size
c) orientation
- CSS 2D transform allows only 2-dimensions i.e x-axis and y-axis.
Note: "Plugin is small set of software tools that provide additional functionality to
existing application".
transform : attributes..
transform
webkit-transform
moz-transform
ms-transform
o-transform
Syntax:
transform : translate(200px, 100px);
transform : translateX(200px);
Plugins:
webkit-transform: translate(200px, 100px);
moz-transform:translate(200px, 100px);
ms-transform:translate(200px, 100px);
Note: Transformation takes just a fraction of milli seconds, you can control the
transformation time by using "transition" attribute.
Browser Engine
- Webkit
- Gecko
- Chromium
- Chakra
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
.box {
width: 50px;
height: 50px;
border:2px solid red;
transition-duration: 5s;
}
.box:hover {
transform: translate(200px, 100px);
-webkit-transform: translate(200px, 100px);
-moz-transform: translate(200px, 100px);
transition-duration: 2s;
}
</style>
</head>
<body>
<div class="box">
<img src="../public/images/speaker.jpg" width="50" height="50">
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
.box {
width: 150px;
height: 150px;
border:2px solid red;
transition-duration: 5s;
}
.box:hover {
transform: scale(2.5, 1.5);
transition-duration: 2s;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 600px;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
<img src="../public/images/speaker.jpg" width="150" height="150">
</div>
</div>
</body>
</html>
CSS 3D
Sudhakar Sharma
•
Yesterday
CSS 2D Transitions
- translate()
translateX()
translateY()
- scale()
- scaleX()
- scaleY()
rotate()
- Changes the orientation of element by specified angle.
rotate()
rotateX()
rotateY()
Sytax:
rotate(60deg) clockwise
rotate(-60deg) counter clockwise
skew()
- It is used to tilt image by specified angle.
skew()
skewX()
skewY()
Syntax:
skew(60deg)
skew(-60deg)
CSS 3D Transform
translate3d()
translateX()
translateY()
translateZ()
scale3d()
rotate3d()
skew3d()
Syntax:
element {
transform: scale3d(x, y, z);
}
element {
transform: scale3d(1.5, 0, 0.5);
}
CSS Transition
============
- Transition comprises of animation timing and effects.
Syntax:
element {
width: 800px;
transition-duration: 4s;
transition-delay:2s;
transtion-property: width;
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Grid</title>
<style>
.container {
width: 100px;
height: 100px;
background-color: red;
transition-duration: 2s;
transition-property: width;
}
.container:hover {
width: 800px;
background-color: yellow;
transition-duration: 2s;
transition-property: width;
}
</style>
</head>
<body>
<div class="container">
</div>
</body>
</html>
Predefined Animations
Syntax:
element {
transition-timing-function: steps(3);
}
element:hover {
transition-timing-function: ease-in;
}
CSS Animations
============
CSS Animations
Sudhakar Sharma
•
5:35 PM
CSS Keyframes
- Animation is configured with frames.
- Static frame comprises of object without any change in position or size.
- Keyframe comprises of object with change in position or size.
- CSS provides "@keyframes { }" for configuring tweening animation.
- Tweening is the process of specifying effects at regular frame intervals, the other frames are
configured automatically.
- Tween contains initial postion, final position and any specified position.
Syntax:
@keyframes referenceName
{
from { initial effects }
to { final effects }
}
- You can add any specific position between from and to.
10% { }
50% { }
90% { }
- To apply keyframe to any element in page you have to use the following attributes
Syntax:
@keyframes name {
#element {
animation-name : name;
animation-duration: 4s;
animation-direction: alternate;
animation-iteration-count: infinite;
}
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Animations</title>
<style>
@keyframes slideIn {
from {
margin-left: 120%;
width: 200%;
height: 200%;
margin-top: 400px;
transform: rotate(360deg);
}
to {
margin-left: 0%;
width: 100px;
height: 100px;
margin-top: 0px;
transform: rotate(0deg);
}
}
@keyframes zoomEffect {
from {
margin-top: 300px;
margin-right: 150%;
transform: scale(3);
}
50% {
margin-left: 300px;
}
to {
margin-top: 0px;
margin-right: 50%;
transform: scale(1);
}
}
#pic {
animation-name: slideIn;
animation-duration: 5s;
animation-direction: alternate;
animation-iteration-count: infinite;
}
h2 {
animation-name: zoomEffect;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
body {
overflow: hidden;
}
</style>
</head>
<body>
<h2>Welcome</h2>
<img id="pic" src="../public/images/speaker.jpg" width="100" height="100">
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Animations</title>
<style>
@keyframes zoom {
from {
margin-left: 120%;
height:200px;
width: 200px;
font-size: 50px;
}
50% {
height: 450px;
width: 450px;
font-size: 30px;
}
80% {
font-size: 80px;
}
to {
margin-left: 0%;
height: 400px;
width: 400px;
font-size: 20px;
}
}
body {
overflow: hidden;
}
p{
animation-name: zoom;
animation-duration: 5s;
animation-direction: alternate;
animation-iteration-count: infinite;
}
</style>
</head>
<body>
<p>Your use of this software is subject to the terms and conditions of the license
agreement by which you acquired this software. If you are a volume license customer, use of
this software is subject to your volume license agreement. You may not use this software if
you have not validly acquired a license for the software from Microsoft or its licensed
distributors.
</p>
</body>
</html>
Syntax:
matrix(scaleX(), skewY(), skewX(), scaleY(), translateX(), translateY());
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Animations</title>
<style>
#box {
width: 100px;
height: 100px;
background-color: red;
transition: 5s;
}
#box:hover {
transform: matrix(1.5,5,5,0.5,100,100);
transition: 4s;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 500px;
}
</style>
</head>
<body>
<div id="box">
<img src="../public/images/speaker.jpg" width="100" height="100">
</div>
</body>
</html>
CSS Responsive
CSS Responsive Design
- Designing content which can fit on to various devices i.e mobile, pc, laptop, tab etc.
- To configure responsive design for web page we have to use the following features and
options.
Syntax:
<meta name="viewport" content="width=device-width, Initial-scale=1">
Fluid Images:
- Images are defined with size in %.
Syntax:
<img width="45%" height="50%">
container {
display:grid;
grid-template-columns: fr fr fr;
}
component {
grid-row : number;
grid-column: number;
}
- Flex with wrap also fits the content according to device.
container {
display:flex;
flex-wrap: wrapping options;
}
container {
columns: count;
column-gap: number;
column-width:number;
}
Media Queries
============
- Media options are used to target various devices.
a) Print
b) Screen
c) Speech
Syntax:
<style>
@media screen {
}
@media print {
}
@media speech {
}
</style>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<meta name="viewport" content="width=device-width, intial-scale=1.0">
<style>
@media screen {
body {
width: 90%;
padding: 10px;
background-image: url("../public/images/netflixback.jpg");
}
h2 {
background-color: red;
color:white;
text-align: center;
border:2px solid yellow;
}
aside {
width: 100px;
height: 80px;
background-color: blue;
color:white;
font-size: 20px;
position: fixed;
right: 30px;
}
}
@media print {
body {
width: 90%;
padding: 10px;
}
h2 {
background-color: black;
color:white;
text-align: left;
padding: 5px;
}
aside {
display: none;
}
}
@media speech {
p{
display: none;
}
}
</style>
</head>
<body>
<h2>CSS Responsive Design</h2>
<p>some text..</p>
<aside>
ads..
</aside>
</body>
</html>
Syntax:
@media screen and (expression)
{
}
expression : orientation=landscape
orientation=portrait
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Toolbar</title>
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
ul {
list-style: none;
}
li {
border:1px solid red;
background-color: tomato;
color:white;
padding: 5px;
width: 150px;
}
@media screen and (orientation:landscape) {
li {
display: inline;
margin-right: 30px;
width: 150px;
}
ul {
background-color: tomato;
}
}
@media screen and (orientation:portrait) {
li {
display: block;
margin-bottom: 30px;
width: 30px;
background-color: black;
}
ul {
background-color: tomato;
padding: 20px;
width: 50px;
}
.nav-title {
display: none;
}
}
</style>
</head>
<body>
<nav>
<ul>
<li><span class="bi bi-facebook"></span> <span class="nav-
title">Facebook</span> </li>
<li><span class="bi bi-twitter"></span> <span class="nav-title">Twitter</span>
</li>
<li><span class="bi bi-linkedin"></span> <span class="nav-
title">Linkedin</span> </li>
<li><span class="bi bi-instagram"></span> <span class="nav-
title">Instagram</span> </li>
</ul>
</nav>
</body>
</html>
<style>
@media screen and (width:600px) {
body {
background-color: yellow;
}
}
</style>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Queries</title>
<style>
@media screen and (min-width:600px) {
body {
background-color: yellow;
}
}
@media screen and (max-width:599px) {
body {
background-color: green;
}
}
</style>
</head>
<body>
<p>Media Queries</p>
</body>
</html>
Bootstrap Positions
Bootstrap Box Model
=================
- Margins
.m
- Padding
.p
- Border
.border
.border-top, bottom, start, end
colors => .border-{contextual} [primary, secondary, success, danger
warning, etc.]
.border-1 to 5 [width]
.rounded [radius]
.rounded-top
.rounded-end
.rounded-bottom
.rounded-start
.rounded-circle
.rounded-pill
.rounded-0 to 3
Backgrounds
==========
Background color
Text Color
Background Opacity
Syntax
<p class="bg-primary bg-opacity-75"> </p>
Background Gradient
.bg-gradient
Syntax:
<p class="bg-danger bg-gradient"> </p>
Bootstrap Positions
===============
.position-{value}
.position-fixed
.position-static
.position-relative
.position-absolute
.position-sticky
- For positions absolute and fixed you have to define location by using
top - 0, 50, 100
start - left 0 , 50, 100
end - right 0, 50, 100
bottom - 0, 50, 100
Syntax:
<img class="position-fixed top-0 end-0">
<img class="position-absolute top-50, end-100">
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="d-flex justify-content-center align-items-center" style="height: 500px;">
<form class="border border-3 p-3 border-primary">
<dl>
<dt>User Name</dt>
<dd><input type="text"></dd>
<dt>Password</dt>
<dd><input type="password"></dd>
</dl>
<button>Login</button>
</form>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="d-flex flex-wrap">
<div class="m-2 border border-2 border-danger" style="height: 200px;width:
200px;">
box-1
</div>
<div class=" m-2 border border-2 border-danger" style="height: 200px;width:
200px;">
box-2
</div>
<div class=" m-2 border border-2 border-danger" style="height: 200px; width:
200px;">
box-3
</div>
<div class=" m-2 border border-2 border-danger" style="height: 200px;width:
200px;">
box-4
</div>
<div class=" m-2 border border-2 border-danger" style="height: 200px;width:
200px;">
box-5
</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:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<h2>Product Details</h2>
<dl class="row">
<dt class="col-3">Name</dt>
<dd class="col-9">Samsung TV</dd>
<dt class="col-3">Price</dt>
<dd class="col-9">56000.55</dd>
<dt class="col-3">Stock</dt>
<dd class="col-9">Available</dd>
</dl>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="m-2 p-2 bg-dark text-white text-center">
Back to Top
</div>
<div class="row bg-dark bg-gradiant m-2 p-2 text-white">
<div class="col">
<ul>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
</ul>
</div>
<div class="col">
<ul>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
</ul>
</div>
<div class="col">
<ul>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
</ul>
</div>
<div class="col">
<ul>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
</ul>
</div>
</div>
<div class="row m-2 p-2 bg-dark text-white text-center">
<div class="col">
© copyright 2022
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Bootstrap Components
- A component comprises of pre-defined styles and functionality.
Bootstrap Alerts
============
- Alerts are used for embedded message box in page.
- You can control the message box dynamically by using jquery attributes.
Classes:
.alert
.alert-link
.alert-title
.alert-text
Colors By using:
.bg-{contextual}
.text-{contextual}
.alert-{contextual} primary, danger, success, warning etc..
Syntax:
<div class="alert alert-danger">
<h2 class="alert-title"> </h2>
<p class="alert-text"> </p>
<a href="#" class="alert-link"> </a>
</div>
Closing Alert:
.btn-close It is used to design a close button
.alert-dismissable It is an alert suitable for closing.
Syntax:
<button class="btn-close" data-bs-dissmiss="alert"> </button>
<button data-bs-dissmiss="alert"> OK </button>
Animation:
.fade Adds fade effect
.show To display by default
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<h2>Alerts</h2>
<div class="alert fade show alert-danger alert-dismissable">
<button class="btn-close" data-bs-dismiss="alert"></button>
<h2 class="alert-title">Delete Record</h2>
Bootstrap Buttons
=============
.btn
.btn-{contextual}
.btn-sm
.btn-lg
.btn-outline-{contextual}
.btn-link
.btn-close
.btn-group
.btn-toolbar
Syntax:
<button class="btn btn-primary"> </button>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<h2>Generic Button</h2>
<button class="btn-close"></button>
<button class="btn btn-link">Login</button>
<h2>Button Toolbar</h2>
<div class="btn btn-toolbar justify-content-between bg-danger">
<div class="btn-group">
<button class="btn btn-danger"> <span class="bi bi-house-fill"></span>
Home</button>
<button class="btn btn-danger"> <span class="bi bi-person-fill"></span>
About</button>
<button class="btn btn-danger"> <span class="bi bi-bell"></span>
Contact</button>
</div>
<div class="btn-group">
<button class="btn btn-danger">Signin</button>
<button class="btn btn-danger">Help?</button>
</div>
</div>
<h2>Basic Button</h2>
<button class="btn">Normal Button</button>
<h2>Contextual</h2>
<button class="btn btn-primary">Insert</button>
<button class="btn btn-danger">Delete</button>
<button class="btn btn-warning">Update</button>
<h2>Outline Contextual</h2>
<button class="btn btn-outline-primary">Insert</button>
<button class="btn btn-outline-danger">Delete</button>
<button class="btn btn-outline-warning">Update</button>
<h2>Size</h2>
<button class="btn btn-primary btn-sm">Insert</button>
<button class="btn btn-danger">Delete</button>
<button class="btn btn-warning btn-lg">Update</button>
<h2>Group</h2>
<div class="btn-group">
<button class="btn btn-danger">Insert</button>
<button class="btn btn-danger">Delete</button>
<button class="btn btn-danger">Update</button>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Bootstrap Forms
==============
Input group and forms
Bootstrap Forms
.form-label : labels
Syntax:
<label class="form-label">
<input type="text" class="form-control">
<input type="range" class="form-range">
<input type="checkbox" class="form-check-input">
<select class="form-select">
<textarea class="form-control">
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="d-flex justify-content-center align-items-center">
<form>
<h2>Register New User</h2>
<div class="mb-3">
<label class="form-label" for="UserName">User Name</label>
<div>
<input type="text" class="form-control" name="UserName">
</div>
</div>
<div class="mb-3">
<label class="form-label" for="Password">Password</label>
<div>
<input class="form-control" type="password" name="Password">
</div>
</div>
<div class="mb-3">
<label class="form-label" for="City">Your City</label>
<div>
<select name="City" class="form-select" >
<option>Delhi</option>
<option>Hyd</option>
</select>
</div>
</div>
<div class="mb-3">
<label class="form-label" for="Subscribe">Want Subscribtion?</label>
<div class="form-switch">
<input class="form-check-input" type="checkbox"> <label class="form-
check-label">Yes</label>
</div>
</div>
<div class="mb-3">
<label class="form-label" for="Price">Select Price</label>
<div>
<input type="range" class="form-range" min="1" max="400000" value="1">
</div>
</div>
<div class="mb-3">
<button class="btn btn-primary w-100">Register</button>
</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>
Note: To keep form elements side by side bootstrap upto 4 version uses "form-inline".
Bootstrap 5 recommends "display" options.
Bootstrap Input Group
=================
Bootstrap 4
.input-group
.input-group-append
.input-group-prepend
.input-group-text
.input-group-sm | lg
Bootstrap-5
.input-group
.input-group-text
.input-group-sm | lg
Syntax:
<div class="input-group">
<span class="input-group-text"> Prefix </span>
<input type="text" class="form-control">
<span class="input-group-text> Suffix </span>
</div>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
body {
background-color: black;
color:white;
}
</style>
</head>
<body class="container-fluid">
<h2>Prefix and Suffix</h2>
<div class="input-group">
<input type="text" placeholder="Your email id" class="form-control">
<span class="input-group-text">@</span>
<input type="text" placeholder="Domain name" class="form-control">
</div>
<h2>Multiple Prepend</h2>
<div class="input-group">
<span class="input-group-text">First Name</span>
<span class="input-group-text">Last Name</span>
<input type="text" class="form-control">
</div>
<h2>Amazon Search Bar</h2>
<div class="input-group">
<select class="input-group-text">
<option>All</option>
<option>Electronics</option>
<option>Footwear</option>
<option>Fashion</option>
</select>
<input type="text" class="form-control">
<button class="btn btn-warning">
<span class="bi bi-search"></span>
</button>
</div>
<h2>Netflix Register</h2>
<div class="input-group input-group-lg">
<input type="email" placeholder="Your email address" class="form-control">
<button class="btn btn-danger">
Get Started <span class="bi bi-chevron-right"></span>
</button>
</div>
<h2>Register</h2>
<div class="input-group">
<input type="text" placeholder="Your gmail id" class="form-control">
<span class="input-group-text">@gmail.com</span>
</div>
<h2>Price</h2>
<div class="input-group">
<span class="input-group-text">₹</span>
<input type="text" class="form-control">
<span class="input-group-text">.00</span>
</div>
<h2>Register</h2>
<div class="input-group mb-3">
<span class="bi bi-person-fill input-group-text"></span>
<input type="text" class="form-control" placeholder="User Name">
<span class="bi bi-check-circle input-group-text"></span>
</div>
<div class="input-group mb-3">
<span class="bi bi-key-fill input-group-text"></span>
<input type="password" class="form-control" placeholder="Password">
<span class="bi bi-check-circle input-group-text"></span>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Spinners
=======
- Used for displaying the status of any task performed in page.
like downloading, uploading, loading, etc..
.spinner-border
.spinner-border-sm | lg
.spinner-grow
.spinner-grow-sm | lg
Syntax:
<span class="spinner-border spinner-border-sm text-danger">
<span class="spinner-grow spinner-grow-sm text-warning">
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
</style>
</head>
<body class="container-fluid">
<h2>Spinners</h2>
<button class="btn btn-outline-danger">
<span class="spinner-border text-warning spinner-border-sm"></span> Loading
</button>
<button class="btn btn-outline-danger">
<span class="spinner-grow text-warning spinner-grow-sm"></span> Loading
</button>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Bootstrap Badge, Pagination, Cards
Bootstrap Progress
- It is used for showing status of task performed in page.
- It can display multiple progress bars with various progress status.
.progress
.progress-bar
.progress-bar-animated
.progress-bar-stripped
Syntax:
<div class="progress">
<div class="progress-bar"></div>
</div>
- Progress status is defined by using "style=width:40%"
Syntax:
<div class="progress-bar" style="width:30%"> </div>
Syntax:
<div class="progress-bar bg-sucess"> </div>
Syntax:
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
</style>
</head>
<body class="container-fluid">
<h2>HTML Progress</h2>
<progress min="1" max="100" value="30">
</progress>
20% completed
<h2>Bootstrap Progress</h2>
<div class="progress">
<div class="progress-bar progress-bar-animated progress-bar-striped bg-success"
style="width: 30%;">
30% Completed
</div>
<div class="progress-bar progress-bar-animated progress-bar-striped bg-danger"
style="width: 70%;">
70% Remaining
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Bootstrap Badge
=============
- It is used to display containers within a container to highlight any value.
.badge
.badge-pill
Syntax:
<span class="badge badge-pill"> text </span>
Ex:
<button class="btn btn-primary position-relative">
<span class="bi bi-bell-fill"></span> Notifications <span class="badge position-
absolute bg-dark">5</span>
</button>
Bootstrap Pagination
================
- It designs pagination for navigation with in the data context.
.pagination
.page-item
.page-link
.active
.disabled
.pagination-sm
.pagination-lg
Syntax:
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
</style>
</head>
<body class="container-fluid">
<h2>Pagination</h2>
<table border="1" class="table" width="500">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<ul class="pagination pagination-sm">
<li class="page-item"><a class="page-link" href="#"> « </a></li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item active"><a class="page-link" href="#">3</a></li>
<li class="page-item disabled"><a class="page-link" href="#">4</a></li>
<li class="page-item"><a class="page-link" href="#">5</a></li>
<li class="page-item"><a class="page-link" href="#"> »</a></li>
</ul>
</td>
</tr>
</tfoot>
</table>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Bootstrap Tables
=============
.table
.table-hover
.table-bordered
.table-stripped
.table-responsive
.table-dark
.table-light
Syntax:
<table class="table table-hover table-stripped">
Syntax: Responsive
<div class="table-responsive">
<table class="table">
</table>
</div>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
</style>
</head>
<body class="container-fluid">
<h2>Pagination</h2>
<div class="table-responsive">
<table border="1" class="table table-hover" width="500">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Name</th>
<th>Price</th>
<th>Stock</th>
</tr>
</thead>
<tbody>
<tr>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
</tr>
<tr>
<td>Mobile</td>
<td>12000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
</tr>
<tr>
<td>TV</td>
<td>56000.44</td>
<td>Available</td>
</tr>
<tr>
<td>Mobile</td>
<td>12000.44</td>
<td>Available</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<ul class="pagination pagination-sm">
<li class="page-item"><a class="page-link" href="#"> « </a></li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item active"><a class="page-link" href="#">3</a></li>
<li class="page-item disabled"><a class="page-link" href="#">4</a></li>
<li class="page-item"><a class="page-link" href="#">5</a></li>
<li class="page-item"><a class="page-link" href="#"> »</a></li>
</ul>
</td>
</tr>
</tfoot>
</table>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Bootstrap Cards
============
.card
.card-header
.card-body
.card-footer
.card-title
.card-subtitle
.card-text
.card-image-overlay
.card-image-top
.card-image-bottom
Syntax:
<div class="card">
<div class="card-header">
</div>
<div class="card-body">
</div>
<div class="card-footer">
</div>
<img class="card-image-top">
</div>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
</style>
</head>
<body class="container-fluid">
<h2>Products Catalog</h2>
<div class="d-flex flex-wrap">
<div class="card bg-warning text-white p-2 m-2" style="width:240px">
<img src="../public/images/neckband.PNG" height="200" class="card-image-top">
<div class="card-header" style="height: 130px;">
<h2 class="card-title">boAT Neckband</h2>
<p class="card-subtitle">40% off</p>
</div>
<div class="card-body">
<dl class="card-text">
<dt>Price</dt>
<dd>5600.55</dd>
<dt>Stock</dt>
<dd>Available</dd>
<dt>Rating</dt>
<dd><span class="bi bi-star-fill text-success"></span> 4.3 </dd>
</dl>
</div>
<div class="card-footer">
<button class="btn btn-danger w-100">
<span class="bi bi-cart4"></span>
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>
.collapse
.show : Toggle display
.fade : Transition
jQuery Attributes:
data-bs-toggle : Specifies the component type.
data-bs-target : Specifies the target element id reference.
Syntax:
<button data-bs-target="#preview" data-bs-toggle="collapse">
</button>
ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
</style>
</head>
<body class="container-fluid">
<h2>Product Details</h2>
<dl>
<dt>Name</dt>
<dd>boAt Neckband</dd>
<dt>Price</dt>
<dd>6000.33</dd>
<dt><button data-bs-target="#preview" data-bs-toggle="collapse" class="btn btn-
primary">Preview Toggle</button></dt>
<dd class="collapse show fade" id="preview">
<img src="../public/images/neckband.PNG" width="200" height="200">
</dd>
</dl>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Bootstrap Accordion
===============
- It is a set of components which can toggle display.
- Component is accordion will use Mutex mechanism.
[Mutual Exclusion]
- Only one component can show its content.
.accordion
.accordion-item
.accordion-header
.accordion-body
.accordion-footer
.accordion-button
.accordion-collapse
jQuery Attributes:
The jquery attributes are similar for all component for handling interactions.
data-bs-target
data-bs-toggle
data-bs-dismiss
data-bs-parent - to bind all accordion items to
the parent.
Syntax:
<div class="accordion" id="parent">
<div class="accordion-item">
<div class="accordion-header">
<button class="accordion-button" data-bs-target="c1" data-bs-toggle="collapse"> Your
Text </button>
</div>
<div class="accordion-collapse collapse show" id="c1" data-bs-parent="#parent">
<div class="accordion-body">
......... your content...........
</div>
</div>
</div>
</div>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
body {
margin-left: 20%;
margin-right: 20%;
background-color: black;
color:white;
}
</style>
</head>
<body>
<div class="d-flex justify-content-center align-items-center">
<div>
<h1>Frequently Asked Questions</h1>
<div class="accordion" id="faq">
<div class="accordion-item">
<div class="accordion-header">
<button data-bs-target="#q1" data-bs-toggle="collapse" class="btn w-100
mb-2 bg-dark text-white">What is Netflix?</button>
</div>
<div class="accordion-collapse collapse show" id="q1" data-bs-
parent="#faq">
<div class="accordion-body bg-dark text-white">
<p>Netflix is a streaming service that offers a wide variety of award-
winning TV shows, movies, anime, documentaries and more – on thousands of internet-
connected devices.</p>
<p>You can watch as much as you want, whenever you want, without a
single ad – all for one low monthly price. There's always something new to discover, and new
TV shows and movies are added every week!</p>
</div>
</div>
</div>
<div class="accordion-item">
<div class="accordion-header">
<button data-bs-target="#q2" data-bs-toggle="collapse" class="accordion-
button">How to Register?</button>
</div>
<div class="accordion-collapse collapse" id="q2" data-bs-parent="#faq">
<div class="accordion-body bg-dark text-white">
<p>Netflix is a streaming service that offers a wide variety of award-
winning TV shows, movies, anime, documentaries and more – on thousands of internet-
connected devices.</p>
<p>You can watch as much as you want, whenever you want, without a
single ad – all for one low monthly price. There's always something new to discover, and new
TV shows and movies are added every week!</p>
</div>
</div>
</div>
<div class="accordion-item">
<div class="accordion-header">
<button data-bs-target="#q3" data-bs-toggle="collapse" class="accordion-
button">Where i can watch?</button>
</div>
<div class="accordion-collapse collapse" id="q3" data-bs-parent="#faq">
<div class="accordion-body bg-dark text-white">
<p>Netflix is a streaming service that offers a wide variety of award-
winning TV shows, movies, anime, documentaries and more – on thousands of internet-
connected devices.</p>
<p>You can watch as much as you want, whenever you want, without a
single ad – all for one low monthly price. There's always something new to discover, and new
TV shows and movies are added every week!</p>
</div>
</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>
Bootstrap Carousel
===============
- It is used for displaying sliding and fading banners in page.
- It is used to control slide show for a set of images in page.
Basic Design
.carousel
.carousel-inner
.carousel-item
Syntax:
<div class="carousel">
<div class="carousel-inner">
<div class="carousel-item">
........your content..........
</div>
</div>
</div>
3. Slide show will not start automatically, you have to define the attribute "data-bs-ride" for
carousel.
4. The default animation style for item is fade, you have to apply "slide".
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="../public/images/slide1.PNG" class="w-100 d-block">
</div>
<div class="carousel-item">
<img src="../public/images/slide2.PNG" class="w-100 d-block">
</div>
<div class="carousel-item">
<img src="../public/images/slide3.PNG" class="w-100 d-block">
</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 Controls:
- controls are used to manually navigate between previous and next slides.
.carousel-control-prev
.carousel-control-prev-icon
.carousel-control-next
.carousel-control-next-icon
jQuery attributes:
data-bs-slide="prev"
data-bs-slide="next"
data-bs-target="carousel id"
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="carousel slide carousel-dark" data-bs-ride="carousel" id="banner">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="../public/images/slide1.PNG" class="w-100 d-block">
</div>
<div class="carousel-item">
<img src="../public/images/slide2.PNG" class="w-100 d-block">
</div>
<div class="carousel-item">
<img src="../public/images/slide3.PNG" class="w-100 d-block">
</div>
</div>
<button data-bs-target="#banner" data-bs-slide="prev" class="carousel-control-prev">
<span class="carousel-control-prev-icon"></span>
</button>
<button data-bs-target="#banner" data-bs-slide="next" class="carousel-control-next">
<span class="carousel-control-next-icon"></span>
</button>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Carousel Indicators
- They are used to slide to any specific item.
.carousel-indicators
data-bs-slide-to="index"
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="carousel slide carousel-dark" data-bs-ride="carousel" id="banner">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="../public/images/slide1.PNG" class="w-100 d-block">
</div>
<div class="carousel-item">
<img src="../public/images/slide2.PNG" class="w-100 d-block">
</div>
<div class="carousel-item">
<img src="../public/images/slide3.PNG" class="w-100 d-block">
</div>
</div>
<button data-bs-target="#banner" data-bs-slide="prev" class="carousel-control-prev">
<span class="carousel-control-prev-icon"></span>
</button>
<button data-bs-target="#banner" data-bs-slide="next" class="carousel-control-next">
<span class="carousel-control-next-icon"></span>
</button>
<div class="carousel-indicators">
<button data-bs-target="#banner" data-bs-slide-to="0" class="active"></button>
<button data-bs-target="#banner" data-bs-slide-to="1" ></button>
<button data-bs-target="#banner" data-bs-slide-to="2" class=""></button>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
- You control carousel item timings by using
"data-bs-interval=5000"
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="carousel slide carousel-dark" data-bs-ride="carousel" id="banner">
<div class="carousel-inner">
<div class="carousel-item active" data-bs-interval="4000">
<img src="../public/images/slide1.PNG" class="w-100 d-block">
</div>
<div class="carousel-item" data-bs-interval="1000">
<img src="../public/images/slide2.PNG" class="w-100 d-block">
</div>
<div class="carousel-item" data-bs-interval="3000">
<img src="../public/images/slide3.PNG" class="w-100 d-block">
</div>
</div>
<button data-bs-target="#banner" data-bs-slide="prev" class="carousel-control-prev">
<span class="carousel-control-prev-icon"></span>
</button>
<button data-bs-target="#banner" data-bs-slide="next" class="carousel-control-next">
<span class="carousel-control-next-icon"></span>
</button>
<div class="carousel-indicators">
<button data-bs-target="#banner" data-bs-slide-to="0" class="active"></button>
<button data-bs-target="#banner" data-bs-slide-to="1" ></button>
<button data-bs-target="#banner" data-bs-slide-to="2" class=""></button>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Modal, Dropdown and Nav
Bootstrap Modal
=============
- It is used for dynamic dialog boxes.
- A dialog box can open and close dynamically.
.modal
.modal-dialog
.modal-content
.modal-header
.modal-body
.modal-footer
Syntax:
<div class="modal">
<div class="modal-dialog">
<div class="modal-content">
-- header ---
-- body --
-- footer --
</div>
</div>
</div>
Syntax:
<div class="modal-dialog modal-dialog-scrollable">
</div>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-
icons.css">
</head>
<body class="container-fluid">
<h2>Modals</h2>
<button data-bs-target="#login" data-bs-toggle="modal" class="btn btn-
primary">Login</button>
<div class="modal fade" id="login">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h2>User Login</h2>
<button data-bs-dismiss="modal" class="btn-close"></button>
</div>
<div class="modal-body">
<dl>
<dt>User Name</dt>
<dd><input type="text" class="form-control"></dd>
<dt>Password</dt>
<dd><input type="password" class="form-control"></dd>
<dt>User Name</dt>
<dd><input type="text" class="form-control"></dd>
<dt>Password</dt>
<dd><input type="password" class="form-control"></dd>
<dt>User Name</dt>
<dd><input type="text" class="form-control"></dd>
<dt>Password</dt>
<dd><input type="password" class="form-control"></dd>
<dt>User Name</dt>
<dd><input type="text" class="form-control"></dd>
<dt>Password</dt>
<dd><input type="password" class="form-control"></dd>
<dt>User Name</dt>
<dd><input type="text" class="form-control"></dd>
<dt>Password</dt>
<dd><input type="password" class="form-control"></dd>
<dt>User Name</dt>
<dd><input type="text" class="form-control"></dd>
<dt>Password</dt>
<dd><input type="password" class="form-control"></dd>
<dt>User Name</dt>
<dd><input type="text" class="form-control"></dd>
<dt>Password</dt>
<dd><input type="password" class="form-control"></dd>
</dl>
</div>
<div class="modal-footer">
<button class="btn btn-primary">Login</button>
<button data-bs-dismiss="modal" class="btn btn-
danger">Cancel</button>
</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>
Syntax:
<a href="#id" data-bs-toggle="modal"> </a>
Bootstrap Dropdown
================
- HTML Dropdown is defined by using <select> with <option>
- It is RC data type.
- It is good for adding and removing elements dynamically.
- Bootstrap dropdown allows selection of items dynamically.
- It allows symbols, icons into options.
- It is not good for dynamically adding and removing of elements.
- It is good for designing navigation.
.dropdown
.dropup
.dropstart
.dropend
.dropdown-toggle
.dropdown-item
.dropdown-menu
.dropdown-divider
Syntax:
<div class="dropdown">
<button class="dropdown-toggle" data-bs-target="dropdown"> Menu
</button>
<div class="dropdown-menu collapse">
<div class="dropdown-item">
</div>
<div class="dropdown-divider"> </div>
</div>
</div>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-
icons.css">
</head>
<body class="container-fluid">
<h2>Dropdown</h2>
<div class="dropdown">
<button data-bs-toggle="dropdown" class="dropdown-toggle btn btn-dark" >
<span class="bi bi-globe"></span>
Language
</button>
<div class="dropdown-menu collapse">
<div class="dropdown-item">
<a href="#">English</a>
</div>
<div class="dropdown-item">
<a href="#">हिन्दी</a>
</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">
Help?
</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>
.nav
.nav-tabs
.nav-pills
.nav-item
.nav-link
.tab-content
.tab-pane
Syntax:
<div class="nav nav-tabs">
<div class="nav-item">
<a class="nav-link"> </a>
</div>
</div>
<div class="tab-content">
<div class="tab-pane"> </div>
</div>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-
icons.css">
</head>
<body class="container-fluid">
<h2>Product Info</h2>
<div class="nav nav-tabs">
<div class="nav-item active">
<a href="#basic" data-bs-toggle="tab" class="nav-link">Basic</a>
</div>
<div class="nav-item">
<a href="#preview" data-bs-toggle="tab" class="nav-link">Preview</a>
</div>
<div class="nav-item">
<a href="#description" data-bs-toggle="tab" class="nav-
link">Description</a>
</div>
</div>
<div class="tab-content">
<div class="tab-pane active" id="basic">
<h2>Basic Details</h2>
<dl>
<dt>Name</dt>
<dd>Nike Casuals</dd>
<dt>Price</dt>
<dd>5600.44</dd>
</dl>
</div>
<div class="tab-pane" id="preview">
<h2>Preview</h2>
<img src="../public/images/shoe.jpg" width="200" height="200">
</div>
<div class="tab-pane" id="description">
<h2>Description</h2>
<p>something about nike casuals</p>
</div>
</div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
</body>
</html>
Dynamic Navbar
Dynamic Navbar
================
- It provides responsive navigation bar for webpage.
- Nav Items can change orientation according to device width.
.navbar
.navbar-expand-lg | sm
.navbar-brand
.navbar-toggler
.navbar-toggler-icon
.navbar-nav
.navbar-collapse
.navbar-dark
.navbar-light
.nav-item
.nav-link
.collapse
Syntax"
<div class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a href="#" class="navbar-brand"> Amazon </a>
<button class="navbar-toggler">
<span class="navbar-toggler-icon"> </span>
</button>
<div class="collapse navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item">
<a href="#" class="nav-link"> Text </a>
</li>
</ul>
</div>
</div>
</div>
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="navbar navbar-expand-lg navbar-dark bg-dark mt-2">
<div class="container-fluid">
<button class="navbar-toggler" data-bs-target="#menu" data-bs-toggle="collapse">
<span class="navbar-toggler-icon"></span>
</button>
<a href="#" class="navbar-brand">Amazon</a>
<div class="collapse navbar-collapse" id="menu">
<ul class="navbar-nav">
<li class="nav-item">
<a href="#" class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">About</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Contact</a>
</li>
<li class="nav-item">
<form class="d-flex">
<div class="input-group">
<input type="text" class="form-control">
<button class="btn btn-warning">
<span class="bi bi-search"></span>
</button>
</div>
</form>
</li>
</ul>
</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>
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<style>
.dropdown:hover .dropdown-menu {
display: block;
}
.dropend:hover .dropdown-menu {
display: block;
}
</style>
</head>
<body class="container-fluid">
<div class="dropdown mt-2">
<button data-bs-toggle="dropdown" class="dropdown-toggle btn-dark">
Select Category
</button>
<div class="dropdown-menu dropdown-menu-dark text-white collapse">
<div class="dropdown-item">
<a href="#" class="dropdown-item-text">Electronics</a>
</div>
<div class="dropdown-item">
<div class="dropend">
<button class="dropdown-toggle btn-dark dropdown-item-text">
Fashion
</button>
</div>
</div>
<div class="dropdown-item">
<a href="#" class="dropdown-item-text">Footwear</a>
</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>
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head>
<body class="container-fluid">
<div class="navbar navbar-expand-lg navbar-dark bg-dark mt-2">
<div class="container-fluid justify-content-between">
<button class="navbar-toggler" data-bs-target="#menu" data-bs-toggle="collapse">
<span class="navbar-toggler-icon"></span>
</button>
<a href="#" class="navbar-brand">Amazon</a>
<div class="collapse navbar-collapse" id="menu">
<ul class="navbar-nav">
<li class="nav-item">
<a href="#" class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">About</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Contact</a>
</li>
<li class="nav-item">
<div class="dropdown">
<button data-bs-toggle="dropdown" class="dropdown-toggle btn btn-dark">
Select Category
</button>
<div class="dropdown-menu dropdown-menu-dark text-white collapse">
<div class="dropdown-item">
<a href="#" class="dropdown-item-text">Electronics</a>
</div>
<div class="dropdown-item">
<a href="#" class="dropdown-item-text">Footwear</a>
</div>
</div>
</div>
</li>
<li class="nav-item">
<form class="d-flex">
<div class="input-group">
<input type="text" class="form-control">
<button class="btn btn-warning">
<span class="bi bi-search"></span>
</button>
</div>
</form>
</li>
</ul>
</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>
JavaScript
Sudhakar Sharma
•
Feb 28
JavaScript
========
- JavaScript is light weight "Just-in-time" interpreted or compiled programming language.
JIT - Just-in-Time
AOT - Ahead-of-Time
- JavaScript is not just a client side script, it is a language used to build large scale
applications.
Evolution of JavaScript
==================
- Tim Berners Lee introduced web in early 1990's.
- Tim Berners Lee introduces a language called HTML.
- The first browser was "Mosaic"
- 1994 Netscape Communications developed a browser called
"Netscape Communicator"
ES8