Ui Techonolgy
Ui Techonolgy
Study Materials
Videos ---> 6 months access
Course completion certificate
projects-->covered
2 to 4 years of exp
web application:
----------------
The application which will provide services over the web
gmail.com
facebook.com
1. Front end
2. Back end
1. Front end:
-------------
1
It represents what end user is seeing on the website.
We can develop front end components by using :
HTML,CSS,JS,BootStrap,jQuery etc
Java Script:
-----------
To add functionality to our html components
2
static response: won't be changed from person to person and time to
time.
Dynamic response: will be changed from person to person and time to
time.
2. Back end:
------------
It is technology which is used to decide what to show to end user on
the front end.
3
1. Language: Java,Python,....
2. Framework: 70 to 90% of activities (Struts, JSF,Spring MVC
etc),Django,Flask,Pyramid etc
3. Database: MongoDB,Oracle,MySQL etc
Biryani
We can prepare on our own(writing everything on your own without
using any framework)
We can order online(using framework)
web application
front end--->What we are seeing
HTML,CSS,JS
back end-->generates what we have to see
Language-->Python
Framework: Django
Database-->
9:15PM to 10:30 PM
[email protected]
8885252627
8096969696
4
Session-1: https://www.youtube.com/watch?v=bNjNNtpfLQw
1. Front-End
2. Back-End
2. Back end:
-----------
5
1. Language: Python
2. Framework: Django,Flask,Pyramid etc 70% to 90%
3. Database: SQLite,Oracle,MongoDB etc
Java people
Python + Django
HTML:
-----
gmail.com
HTML:
-----
Hypertext markup language.
compulsory technology
amazon.in
spicejet.com
6
Structure of HTML Page:
------------------------
2 parts
1. Head
2. Body
1. Head:
It contains meta data like title,description,author,keywords etc
Here only we have to provide links to css files, js files
test.py
test.html
<HTML>
<head>
</head>
<body>
</body>
7
</html>
HTML Comments:
--------------
# This is python comment
Heading tags:
--------------
6 heading tags
<h1> This is h1 Heading </h1>
<h2> This is h2 Heading </h2>
<h3> This is h3 Heading </h3>
<h4> This is h4 Heading </h4>
<h5> This is h5 Heading </h5>
<h6> This is h6 Heading </h6>
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
8
<h1> This is h1 Heading </h1>
<h2> This is h2 Heading </h2>
<h3> This is h3 Heading </h3>
<h4> This is h4 Heading </h4>
<h5> This is h5 Heading </h5>
<h6> This is h6 Heading </h6>
</body>
</html>
Paragraph tag:
-------------
<p> This is my first paragraph</p>
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<h1> This is h1 Heading </h1>
<p> This is my first paragraph This is my first paragraphThis is my
first paragraphThis is my first paragraphThis is my first paragraphThis
is my first paragraphThis is my first paragraphThis is my first
9
paragraphThis is my first paragraphThis is my first paragraphThis is my
first paragraphThis is my first paragraphThis is my first paragraphThis
is my first paragraphThis is my first paragraphThis is my first
paragraphThis is my first paragraph</p>
</body>
</html>
case-1:
<p> This is First Line
This is Second Line
This is Third Line
This is Fourth Line
</p>
10
Total data will come in a single line, because we are using only one
paragraph tag.
case-2:
-------
<p> This is First Line</p>
<p> This is Second Line</p>
<p> This is Third Line</p>
<p> This is Fourth Line</p>
4 lines
case-3:
--------
<p> This is First Line</p> <p> This is Second Line</p><p> This is Third
Line</p><p> This is Fourth Line</p>
4 lines
11
LineThis is First LineThis is First LineThis is First LineThis is First
Line</p>
[email protected]
8885252627
8096969696
Session-1: https://www.youtube.com/watch?v=bNjNNtpfLQw
Session-2: https://www.youtube.com/watch?v=l6eKrr8CJQA
Session-3: https://www.youtube.com/watch?v=md-Ztt-QUEk
https://drive.google.com/drive/folders/1GoWlJyZ3P2AWjca0XuIfozgl
y5Gs6j3j?usp=sharing
12
How to plan our life???
How to plan career??
Microsoft 30L
13
200 employees 2 crores
10L --->
Wash clothes-->B.Tech/M.Tech/MCA
but how can we expect everything from others as we Are from middle
class
60 years
25 years
35 years * 365 days
14
SHROLAN-MH2
S-->Speed
H--->Highest result work
R--->Reusable
O--->One time activitiy but continuous results
L--->Less efforts More results
A--->Automation
N--->New Activity for the next level
M--->Money
H--->Health
H-->Happiness
15
<body>
original data which should be displayed to end user
</body>
</html>
comments:
<!-- this is html comment -->
heading tags:
-------------
<h1> .... to <h6>
paragraph tag
<p>
dskajfklsajlfkjsalkjflkdjsaljldsafkj
dskajfklsajlfkjsalkjflkdjsaljldsafkj
dskajfklsajlfkjsalkjflkdjsaljldsafkj
dskajfklsajlfkjsalkjflkdjsaljldsafkj
dskajfklsajlfkjsalkjflkdjsaljldsaf
</p>
16
---------------------
HTML: <b> which is legacy
HTML 5: <strong> instead of <b>
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<p> <strong>This is first line </strong></p>
<p> This is <b>first line</b> </p>
</body>
</html>
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<p> <em><strong>This is first line </strong></em></p>
17
<p> <i>This is <b>first line</b></i> </p>
</body>
</html>
HTML Lists:
-----------
2 types of lists:
-----------------
1. Ordered List(ol)
2. Unordered List(ul)
<ol>
<li> Python </li>
<li> Django </li>
<li> Data Science </li>
18
<li> DRF </li>
</ol>
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<h1> The Available Courses: </h1>
<ul>
<li> Python </li>
<li> Django </li>
<li> Data Science </li>
<li> DRF </li>
</ul>
</body>
</html>
Nested Lists:
-------------
We can use list inside a list
<!doctype html>
19
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<h1> THe Menu Items: </h1>
<ol>
<li> Food </li>
<ul>
<li> Chicken Biryani</li>
<li> Mutton Biryani</li>
<li> Fish Biryani</li>
</ul>
<li> Drinks </li>
<ul>
<li> KF</li>
<li> KO</li>
<li> RC</li>
</ul>
Attributes:
-----------
20
We can pass attributes to the tags, which will provide some extra
information.
Note: We have to open the tag and we are not required to close, such
type of tags are called self closing tags.
<img>
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<h1> The Walrus Operator is because of this animal (:=) </h1>
<img src="walrus_operator1.jpg" alt="Oops image is missing,
will be uploaded soon ">
21
</body>
</html>
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
22
<body>
<h1> Oye...Still you are Leanring Python....</h1>
<img
src="C:\Users\lenovo\Desktop\wonderful\20210103_105938.jpg"
alt="Oops image is missing, will be uploaded soon ">
</body>
</html>
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<h1> DURGASOFT</h1>
<a
href="https://www.youtube.com/channel/UCbjozK_PYCTLEluFlrJ8UZ
g"> Click here to get more vidoes </a>
</body>
</html>
23
Mini Project:
-------------
<!doctype html>
<html lang="en">
<head>
<title>Durga Bar and Restaurant</title>
</head>
<body>
<h1> Welcome to Durga Bar and Restaurant</h1>
<img src="dbar.jpg" alt="will be uploaded soon...">
<p>We are very specialized for Chilled Beer. We have virtual rain
environment with all facilities so that 100% guarantee for the Kick.
We have almost around 1000 brands like takela..We are very
specialized for Chilled Beer. We have virtual rain environment with all
facilities so that <strong>100% guarantee</strong> for the Kick. We
have almost around <strong>1000 brands</strong>like
takela..</p><p>We are very specialized for Chilled Beer. We have
virtual rain environment with all facilities so that 100% guarantee for
the Kick. We have almost around 1000 brands like takela..We are very
specialized for Chilled Beer. We have virtual rain environment with all
facilities so that 100% guarantee for the Kick. We have almost around
1000 brands like takela..</p>
24
<h3> Our offered brands are:</h3>
<ol>
<li> King Fisher</li>
<li> Knock Out</li>
<li> Royal Stag</li>
<li> 100 Pipers</li>
<li> Foster</li>
<li> Teachers Choice</li>
</ol>
<h1> Offer of the Day: <em>BUY ONE GET ONE FREE</em></h1>
<p> View Our Profile</p>
<a href="http://youtube.com"> Youtube</a>
<a href="http://facebook.com"> Facebook</a>
<a href="http://twitter.com"> Twitter</a>
</body>
</html>
sir if we click on that link directly it is going to that page directly.... but
if we want to open that in new tab how to do that sir
Youtube
youtube.com/durgasoftware
25
para
heading
Session-1: https://www.youtube.com/watch?v=bNjNNtpfLQw
Session-2: https://www.youtube.com/watch?v=l6eKrr8CJQA
Session-3: https://www.youtube.com/watch?v=md-Ztt-QUEk
Session-4: https://www.youtube.com/watch?v=kx9BlJ__EKY
https://drive.google.com/drive/folders/1GoWlJyZ3P2AWjca0XuIfozgl
y5Gs6j3j?usp=sharing
26
div means division
We can use <div> tag to group related tags into a single unit.
So that we can define styling for all these tags
<!doctype html>
<html>
<head>
<link rel='stylesheet' href='style.css'/>
<title>Durga Bar and Restaurant</title>
</head>
<body>
<div>
<h1> UI Technologies are very important in web
development </h1>
<h2> UI Technologies are very important in web
development </h2>
<h3> UI Technologies are very important in web
development </h3>
<h2> UI Technologies are very important in web
development </h2>
<h1> UI Technologies are very important in web
development </h1>
</div>
27
<div>
<h1> UI Technologies are very important in web
development </h1>
<h2> UI Technologies are very important in web
development </h2>
<h3> UI Technologies are very important in web
development </h3>
<h2> UI Technologies are very important in web
development </h2>
<h1> UI Technologies are very important in web
development </h1>
</div>
</body>
</html>
span tag:
---------
life span
For inline styling : span tag
28
<h1> The 3 important viruses for the human being: <span>Drinking,
Gambling and Extra Curricular Activities..</span> These are very
dangerous than corona also </h1>
Table Creation:
---------------
<table> to create table
<thead> to specify head row
<th> to specify column data in head row(column name)
<tr> to insert a row in the table
<td> to specify column data in the row/record.
<!doctype html>
<html>
<head>
<title>Sample HTML</title>
</head>
<body>
<h1> DURGASOFT Employees Data</h1>
<table border='2'>
<thead>
<th>ENO</th>
<th>ENAME</th>
<th>ESAL</th>
29
<th>EADDR</th>
</thead>
<tr>
<td>100</td>
<td>Sunny</td>
<td>1000</td>
<td>Mumbai</td>
</tr>
<tr>
<td>100</td>
<td>Sunny</td>
<td>1000</td>
<td>Mumbai</td>
</tr>
<tr>
<td>100</td>
<td>Sunny</td>
<td>1000</td>
<td>Mumbai</td>
</tr>
<tr>
<td>100</td>
<td>Sunny</td>
<td>1000</td>
<td>Mumbai</td>
</tr>
<tr>
<td>100</td>
30
<td>Sunny</td>
<td>1000</td>
<td>Mumbai</td>
</tr>
</table>
</body>
</html>
<!doctype html>
<html>
<head>
<title>Sample HTML</title>
</head>
<body>
<h1> Oscar Awards Winners List for 2021</h1>
<table border='2'>
<thead>
<th>S.NO</th>
<th>WINNER</th>
31
<th>WINNER PIC</th>
<th>CATEGORY</th>
<th>COUNTRY FLAG</th>
<th>VIEW PROFILE</th>
</thead>
<tr>
<td>1</td>
<td>Sunny</td>
<td><img src='sunny.jpg' alt='image not available'
width='300' height='200'></td>
<td>Best Actress</td>
<td><img
src='https://upload.wikimedia.org/wikipedia/en/4/41/Flag_of_India.
svg' width='300' height='200'></td>
<td><a href='http://youtube.com/durgasoftware'>View
Profile</a></td>
</tr>
<tr>
<td>2</td>
<td>Deepika</td>
<td><img src='Deepika.jpg' alt='image not available'
width='300' height='200'></td>
<td>Best Actress</td>
<td><img src='uk.png' width='300' height='200'></td>
<td><a href='http://youtube.com/durgasoftware'>View
Profile</a></td>
</tr>
<tr>
32
<td>3</td>
<td>Priya</td>
<td><img src='priya.jpeg' alt='image not available'
width='300' height='200'></td>
<td>Best Actress</td>
<td><img src='us.png' width='300' height='200'></td>
<td><a href='http://youtube.com/durgasoftware'>View
Profile</a></td>
</tr>
</table>
</body>
</html>
https://attendee.gotowebinar.com/register/5368769457292403467
<form>
</form>
33
<!doctype html>
<html>
<head>
<title>Sample HTML</title>
</head>
<body>
<h1> Student Registration Form</h1>
</body>
</html>
34
text
email
password
radio
checkbox
color
Name attribute represents the name of input tag. By using this in the
next target page we can access its value.
type
35
name
value--->To provide default value.
placeholder --->attribute is just to provide hint but not default value.
Recommended is placeholder
required attribute:
--------------------
Name2 <input type='text' name='name2' placeholder='Enter Name2'
required>
<label for="no">No</label>
<input id='no' type='radio' name='married' value=''><br>
36
eg:
<h3> Gender</h3>
<label for="m">Male</label>
<input id='m' type='radio' name='gender' value='male'>
<label for="fm">Female</label>
<input id='fm' type='radio' name='gender'
value='female'>
<label for="t">Transgender</label>
<input id='t' type='radio' name='gender'
value='transgender'><br>
sir why name is written as => Name: and why not Password: ??
Session-1: https://www.youtube.com/watch?v=bNjNNtpfLQw
Session-2: https://www.youtube.com/watch?v=l6eKrr8CJQA
Session-3: https://www.youtube.com/watch?v=md-Ztt-QUEk
Session-4: https://www.youtube.com/watch?v=kx9BlJ__EKY
https://drive.google.com/drive/folders/1GoWlJyZ3P2AWjca0XuIfozgl
y5Gs6j3j?usp=sharing
37
COMMENTS
Header tags
paragraph
div
span
ol and ul
tables
images
anchor tag
forms
-----
<form action='second.html'>
<input type='text' ....>
<input type='email' ....>
<input type='password' ....>
<input type='color' ....>
<input type='radio' ....>
<input type='submit' ....>
</form>
38
<label for='name'>Name</label>
<input id='name' type='text' name='username' value=''>
page inspection
css styling also
file:///D:/django26/result.html?username=Sunny
In GET method, the data will be appended to the url and send to the
next page.
In Post method, the data will be encapsulated inside request body
and not visible in the url.
file:///D:/django26/result.html
<!doctype html>
39
<html>
<head>
<title>Sample HTML</title>
</head>
<body>
<h1> Student Registration Form</h1>
</body>
</html>
action = request.getParameter('action')
if action == 'ADD':
perform add functionality
elif action == 'REMOVE':
perform remove functionality
elif action == 'UPDATE':
perform update functionality
40
<input type='text' ....>
<input type='email' ....>
<input type='password' ....>
<input type='color' ....>
<input type='radio' ....>
<input type='submit' ....>
Several options are available but we have to select only one option:
radio button
41
<input type='radio' name='q1' value='b'> B<br>
<input type='radio' name='q1' value='c'> C<br>
<input type='radio' name='q1' value='c'> D<br>
<input type='submit' value='Submit Exam'>
file:///D:/django26/result.html?q1=a&q1=c
file:///D:/django26/result.html?q1=a&q1=c&q1=d
<!doctype html>
<html>
<head>
<title>Sample HTML</title>
</head>
<body>
</body>
</html>
42
<!doctype html>
<html>
<head>
<title>Sample HTML</title>
</head>
<body>
</body>
</html>
file:///D:/django26/result.html?language=eng&language=tel&langua
ge=tamil
43
<input type='checkbox' name='language' value='hindi' checked>
Hindi<br>
file:///D:/django26/result.html?state=ap&state=up&state=mh
44
---------------------------------
If few options are available and we have to choose only one option:
radio
If few options are available and we can select any number of options:
checkbox
If very huge number of options are available and we can select any
number of options: dropdown box/select box
textarea:
----------
<!doctype html>
<html>
<head>
<title>Sample HTML</title>
</head>
<body>
45
<input type='submit' value='Submit'>
</form>
</body>
</html>
sir I want to hide data in URL leak in url shall i use POST method
GET vs POST:
------------
If we want to get information from the server-->GET
Download movie but we have to provide movie name-->get
46
https://www.youtube.com/watch?v=E-Y5CeeYJxU
https://www.youtube.com/
atom.io
https://drive.google.com/drive/folders/1GoWlJyZ3P2AWjca0XuIfozgl
y5Gs6j3j?usp=sharing
Durgamatrimonial app:
----------------------
Styling is missing
Functionality is missing- Backend is required
file:///D:/django26/durgamatrimonial1/thankyou.html?username=D
urga&email=info%40subjectroom.com&age=60&dating=Yes&expecta
tions=tamanna&nom=3&alchol=yes&name=No+special+preferences
47
GET Method(Default Method)
POST
file:///D:/django26/durgamatrimonial1/thankyou.html
name attribute is same for the all tags so how can we differentiate in
backend which name attribute is belongs to tag sir...?
name attribute is the same but value is different
[email protected]
8885252627
8096969696
https://www.youtube.com/playlist?list=PLd3UqWTnYXOkA-
bkmcwkbY1iJkcU4aM1r
48
h1,h2,h3...,h6
p
div
span
or,ul
text
submit
radio
password
email
color
checkbox
textarea
b or strong
i or em
dropdown box
table
<br>
HTML Validations:
-----------------
1. email
2. required
3. min and max length
4. only digits are allowed
5. only lower case alphabet symbols are allowed
etc
49
Case-1: The value should contain minimum 5 characters and
maximum 10 characters.
In Regular Expressions:
-----------------------
[0-9] --->Any digit (\d)
[a-z] --->Only lower case alphabet symbol
[A-Z] --->Only upper case alphabet symbol
[a-zA-Z] --->Any alphabet symbol
[a-zA-Z0-9] --->Any alphanumeric character (\w)
. --->Any character
[abc] --->either a or b or c
50
<input type="text" name="val" value="" pattern="" title="msg">
Case-2: The value should contain only digits, exactly 10 digits only
allowed.
pattern='[0-9]{10}'
Case-3: The value should contain only digits, exactly 10 digits only
allowed.
But first digit should be either 6 or 7 or 8 or 9.
pattern='[6-9][0-9]{9}'
[6-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
[6-9][0-9]{9}
9898989897
6786786789
4564564567
case-4:
password atleast 8 characters must be required.
The first character should be upper case alphabet symbol
remaining any alpha numeric.
[A-Z][a-zA-Z0-9]{7}[a-zA-Z0-9]*
51
sir we can put first Letter Uppercase and remaing 2 letter is small and
last character is special symbol
[A-Z][a-z]{2}[^a-zA-Z0-9]
[abc]--->either a or b or c
[a-zA-Z0-9]--->any alphanumeric character
[^abc] --->Except a and b and c any other character
[^a-zA-Z0-9] --->Any character except alpha numeric character
[A-Z][a-z]{2}[^a-zA-Z0-9]
52
CSS(Cascading Style Sheets):
----------------------------
The main objective of CSS is to add styles to HTML.
CSS describes how html elements are displayed on web page.
Styling includes colors,fonts,size,borders etc
sir with html we can create only structure of the webpage but by the
css we can develop beautiful webpage i am correct sir
Atom shortcuts:
----------------
ctrl+shift+d --->Duplicate current line
ctrl+shift+c --->To copy current page full path
ctrl+/ --->to comment/uncomment
File-->Settings-->Editor--->Softwrap =====>word wrapping
1. In Line
2. By using style tag
3. By using external CSS file
1. In Line:
-----------
53
<h1 style="color:red"> This is for CSS Demo</h1>
<head>
<style>
h1{
color:red;
}
</style>
<meta charset="utf-8">
<title>Sample Page</title>
</head>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<style>
h1{
color:blue;
}
</style>
<meta charset="utf-8">
54
<title>Sample Page</title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="style2.css">
</head>
<body>
<h1> This is for CSS Demo</h1>
55
<h1> This is for CSS Demo</h1>
<h1> This is for CSS Demo</h1>
<h1> This is for CSS Demo</h1>
</body>
</html>
sir...I want diffrent color for both page..then how we can show.?
h1{
color:orange;
}
<head>
<link rel='stylesheet' href='style.css'>
</head>
Demo Application-1:
-------------------
56
https://www.youtube.com/playlist?list=PLd3UqWTnYXOkA-
bkmcwkbY1iJkcU4aM1r
2.
color:rgb(0,0,0) ---->Black
color:rgb(255,255,255) ---->White
r--->Red
g-->Green
B-->Blue
Universal colors
color: #f44e42
57
4. rgba
color:rgba(255,255,255)
a means alpha--->Transparency
0.0 to 1.0
Red
Setting background:
--------------------
background:
background-color:
color vs background-color
--------------------------
color-->text color
background color--->
58
background:
url(https://www.remove.bg/images/remove_image_background.jpg);
background-repeat: no-repeat;
background-size: cover;
}
Note:
------
<!-- this is HTML comment -->
/*
This is css comment
*/
img{
border-color: red;
border-width: 20px;
border-style:groove;
}
shortcut way:
-------------
59
img{
1. Element Selectors:
---------------------
Selects all instances of given element and apply the style.
h1{
color: red;
}
2. ID Selectors:
----------------
Selects an element with given Id. But within HTML, ID should be
unique.
60
#specialh1{
color:blue;
}
3. class selectors:
-------------------
selects all elements with the given class and apply styling.
.special{
color: red;
}
100 h1 tags
for all 100 h1 tags red color===>element selectors
only one h1 tag should be displayed in blue color==>id selector
just 15 h1 tags shoould be displayed in orange color===>class selector
element{
property: value;
}
61
#element{
property: value;
}
.element{
property: value;
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Sample Page</title>
<link rel="stylesheet" href="s1.css">
</head>
<body>
<h1>The Importance of CSS</h1>
<h1 class='special'>The Importance of CSS</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.</p>
62
<h1>The Importance of CSS</h1>
<h1 id="specialh1">The Importance of CSS</h1>
<p class='special'>Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<h1 class='special'>The Importance of CSS</h1>
</body>
</html>
Select multiple instances of div tag(but not all div tags) and apply style
class selectors
<div>
to group tags
to group tags
to group tags
63
to group tags
</div>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Sample Page</title>
<link rel="stylesheet" href="s1.css">
</head>
<body>
<h1>Advanced Selectors Demo</h1>
<a href="http://google.com">Click Here to goto Google</a>
<ul>
<li>CAT</li>
<li>RAT</li>
64
<li>ANT</li>
<li>DOG</li>
<li>TIGER</li>
</ul>
<h4>List of Movies:</h4>
<ul>
<li>Bahubali</li>
<li>VakeelSab</li>
<li>KGF-2</li>
<li>F2</li>
<li>F3</li>
</ul>
<h4>List of top websites:</h4>
<ul>
<li> <a href="http://amazon.com">AMAZON</a> </li>
<li> <a href="http://flipkart.com">FLIPKART</a> </li>
<li> <a href="http://paytm.com">PAYTM</a> </li>
<li> <a href="http://durgasoftonline.com">DURGASOFT</a> </li>
</ul>
</body>
</html>
1. * selector:
65
--------------
* means everything
This style is applicable for every tag in the web page
*{
color:blue;
background: yellow;
}
2. Descendant Selector:
-----------------------
sub level-->child tag
p span{
color: red;
}
Style is applicable only for span tags which are present inside p tag.
li a{
color: red;
}
Style is applicable only for anchor tags which are present inside li tag.
body ul li a{
66
color:blue;
background: yellow;
}
3. Adjacent Selectors:
-----------------------
h1+a{
color:blue;
background:yellow;
}
select all anchor tags which are adjacent to h1 and apply styling.
div+p{
color:red;
}
h4+ul{
color:white;
background:red;
}
67
h1+h4{
}
div ul+a{
}
select all anchor tags which are adjancent to ul and that ul present
inside div tag.
* selector
Descendant selector
Adjacent selectors
68
5. Identify small small situations to celebrate.
CSS Selectors:
--------------
To style/makeup html elements(h1,p,div,...)
69
}
2. id selectors:
----------------
#special{
color:red;
}
3. class selectors:
-------------------
.special{
color: red;
}
2. Descendant Selectors:
-----------------------
p c{
color: red;
}
ul a{
70
color: red;
}
3. Adjacent Selectors:
-----------------------
ul+a{
color: red;
}
4. Attribute selector:
----------------------
We can define style based on attribute also.
input[type='password']{
background:yellow;
}
<input type='text'
<input type='password'
<input type='email'
<input type='text'
input[type='password']{
background: yellow;
}
71
a[href="http://flipkart.com"]{
background: red;
}
<ul>
<li>XXX</li>
<li>XXX</li>
<li>XXX</li>
<li>XXX</li>
<li>XXX</li>
</ul>
ul:nth-of-type(2){
background: red;
color:white;
72
}
li:nth-of-type(even){
background: red;
color:white;
}
in li for first and second one color and for thrid and fourth another
color like that we will do in css sir
Basic: 3 (element,id,class)
Advanced: 5(*,descendant,adjacent,attribute,nth of type)
CSS Inheritance:
----------------
What every styles parent tag has, bydefault will be available for child
tags also.
CSS Specificity:
---------------
73
If multiple styles are available for element, then the most specific
style will be considered.
parent-->style1
child--->style2
sir if we want for every list different color then what sir
Assignment-1:
-------------
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>CSS Assignment</title>
</head>
<body>
<h1>This is h1 Data</h1>
<h2>This is h2 tag</h2>
<h2>This is h2 tag</h2>
<h2>This is h2 tag</h2>
<h3>The important Brands are:</h3>
<ul>
74
<li>King Fisher</li>
<li>Royal Challenge</li>
<li>Foster</li>
</ul>
<p class="hello">Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<a href="http://www.gmail.com">Gmail</a>
<a href="http://www.youtube.com">Youtube</a>
75
<a href="http://www.facebook.com">Facebook</a>
Cases:
------
1. Set body tag background color with #bdc646
body{
background
2. Set h1 text color with #9b79b8
3. Make all h2 tags with yellow color
4. Make all <li> elements with blue color,but consider hexa code
5. Change background for every paragraph with white color
6. Make all inputs have a 5px border with red color
7. Set blue background with class attribute hello
and text color as white
8. Give 10px orange solid border for id attribute "special"
9. Make only inputs with type 'text' have a green background
76
10. Make all "checked" check boxes have a left margin of 50px
11. Make the <label> elements all UPPERCASE without changing in
html
12. Make the first letter of the element with id "special" with green
color and 100 px font-size
13. Make <h1> element color change to white when hovered and give
10px solid red border
14. Make all <a> elements that have been visited with yellow color
77
/* 5. Change background for every paragraph with white color */
p{
background: white;
}
78
/* 10. Make all "checked" check boxes have a left margin of 50px */
input:checked{
margin-left: 250px;
}
/* 11. Make the <label> elements all UPPERCASE without changing in
html */
label{
text-transform: uppercase;
}
/* 12. Make the first letter of the element with id "special" with green
color and 100 px font-size */
#special:first-letter{
color:green;
font-size: 50px;
}
/* 13. Make <h1> element color change to white when hovered and
give 10px solid red border */
h1:hover{
color:white;
border: 10px solid red;
79
/* 14. Make all <a> elements that have been visited with yellow color
*/
a:visited{
color:yellow;
}
https://drive.google.com/drive/folders/1GoWlJyZ3P2AWjca0XuIfozgl
y5Gs6j3j?usp=sharing
sir, can you show the background color for every 2nd row in <li> tag
once again.
CSS Selectors:
-------------
1. element selector
h1{
color: red;
}
2. ID selectors
#specialid{
color: red;
}
3. class selector
80
.classname{
color: red;
}
4. * selector
*{
color: red;
}
5. Descendant Selector:
-----------------------
div p {
color: red;
}
6. Adjacent Selectors
div+p{
}
7. Attribute selectors:
input[type='password']{
81
p:nth-of-type(3){
color:red;
}
CSS Inheritance:
----------------
CSS Specificity:
-----------------
<body>
<p>
<div>
<p>
<p>
<p>
</div>
<div>
<p>
<p>
<p>
</div>
<div>
<p>
<p>
<p>
</div>
<p>
82
</bodu>
Assignment2.html:
-----------------
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="assignment2.css">
<title></title>
</head>
<body>
<p>This Para is outside of div. <em> Duis aute irure dolor in
reprehenderit</em> in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. </p>
<div>
<p>This Para is inside of first div. <em> em tag inside first
div</em> in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
83
<p>This Para is inside of first div. <em> em tag inside first
div</em> in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
<div>
<p>This Para is inside of Second div. <em> em tag inside Second
div</em> in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
<div>
<p>This Para is inside of Third div. <em> em tag inside Third
div</em> in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
84
<p>This Para is inside of Third div. <em> em tag inside Third
div</em> in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
assignment2.css:
----------------
/* Case-1: Make all <p>s That are nested inside div with 25px font-size
*/
div p{
font-size: 25px;
}
/* Case-2: Give all <p>s in side 3rd div blue background and text color
is white */
div:nth-of-type(3) p{
background: blue;
color: white;
85
}
/* Case-3: Give 2nd <p> inside 3rd div, 5px red solid border */
div:nth-of-type(3) p:nth-of-type(2){
border: 5px solid red;
}
/* Case-4: Make <em> tag in the 2nd <div> with white color 30 px
font-size and green background */
div:nth-of-type(2) em{
color: white;
font-size: 30px;
background: green;
1. font-family:
86
---------------
cssfontstack.com
2. font-size:
-------------
font-size: 2.0em;
2.0 em units-->Dynamic font size (relative font size)
body
p
span
p{
font-size: 30px;
}
span{
font-size: 0.5em;
}
3. font-weight:
---------------
100 to 900
87
100 means light
900 means too much bold
4. line-height:
---------------
The space between 2 lines
5. text-align:
--------------
6. text-decoration:
-------------------
durga
-----
------
88
durga
durga
cssfontstack.com
89
}
1. Content
2. Padding
3. Border
4. Margin
vibgyor Application:
--------------------
v-->violet
90
html
----
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Vibgyor Implementation</title>
<link rel="stylesheet" href="vibgyor.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Original+Surfer&dis
play=swap" rel="stylesheet">
</head>
<body>
<h1>VIBGYOR Implementation</h1>
<table>
<tr>
<td id='one'></td>
<td id='two'></td>
<td id='three'></td>
<td id='four'></td>
<td id='five'></td>
<td id='six'></td>
<td id='seven'></td>
</tr>
</table>
</body>
</html>
91
css:
----
h1{
text-align: center;
font-family: 'Original Surfer', cursive;
}
table{
margin:auto;
}
td{
height: 300px;
width: 150px;
border:6px solid white;
}
#one{
background: #9400D3;
}
#two{
background: #4B0082;
}
#three{
background: #0000FF;
}
#four{
background: #00FF00;
}
92
#five{
background: #FFFF00;
}
#six{
background: #FF7F00;
}
#seven{
background: #FF0000;
}
93
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
</tr>
<tr>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
</tr>
<tr>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
</tr>
<tr>
94
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
</tr>
<tr>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
</tr>
<tr>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
95
</tr>
<tr>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
</tr>
<tr>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
<td class='black'></td>
<td class='white'></td>
</tr>
</table>
</body>
</html>
css:
96
---
h1{
text-align: center;
}
td{
height: 60px;
width: 60px;
}
.white{
background: white;
}
.black{
background: black;
}
table{
border: 10px solid black;
margin: auto;
}
97
<link rel="stylesheet" href="ttt.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Coda+Caption:wght
@800&display=swap" rel="stylesheet">
</head>
<body>
<h1>Tic Tac Toe Game</h1>
<table>
<tr>
<td></td>
<td class='vertical'></td>
<td></td>
</tr>
<tr>
<td class='horizontal'></td>
<td class='vertical horizontal'></td>
<td class='horizontal'></td>
</tr>
<tr>
<td></td>
<td class='vertical'></td>
<td></td>
</tr>
</table>
</body>
</html>
98
css:
----
td{
height: 100px;
width: 100px;
}
.vertical{
border-left: 5px solid blue;
border-right: 5px solid blue;
}
.horizontal{
border-top: 5px solid blue;
border-bottom: 5px solid blue;
}
table{
margin:auto;
}
h1{
text-align: center;
margin-bottom: 50px;
font-family: 'Coda Caption', sans-serif;
}
td:hover{
background: yellow;
}
99
web applications--->Python Based Framework (Django)
100
<img src="original8.jpg" alt="">
<img src="original9.jpg" alt="">
</body>
</html>
css:
----
img{
height: 300px;
width: 20%;
float:left;
margin: 2.5%;
}
/* img:hover{
border: 3px groove red;
} */
p{
text-align: center;
font-size: 25px;
font-weight: 900;
font-family: 'New Tegomin', serif;
border-bottom: 2px solid red;
padding-bottom: 20px;
}
101
https://drive.google.com/drive/folders/1GoWlJyZ3P2AWjca0XuIfozgl
y5Gs6j3j?usp=sharing
1. Vibgyor
2. Chess
3. TTT
4. Photo Album
5. Durga Gambling Website
6. Blog app
gambling.html:
--------------
<!DOCTYPE html>
<html lang="en" dir="ltr">
102
<head>
<meta charset="utf-8">
<title>DURGA GAMBLING GROUP</title>
<link rel="stylesheet" href="gambling2.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Krona+One&display
=swap" rel="stylesheet">
</head>
<body>
<h1>DURGA GAMBLING GROUP</h1>
<h2>India's No.1 Gambling Group</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.</p>
<h2>Are You Interested to Join This Group:</h2>
<form action='thankyou2.html' method='post'>
103
<label for='name'> Enter Name:</label><br>
<input id='name' type='text' name='name' value=''><br>
<label for='mail'> Enter Mail Id:</label><br>
<input id='mail' type='email' name='mail' value=''><br>
<label for='mno'> Enter Mobile Number:</label><br>
<input id='mno' type='text' name='mno' value=''><br>
<input id='button' type="submit" name="" value="Join Us">
</form>
</body>
</html>
thankyou.html:
--------------
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Thank You Page</title>
<link rel="stylesheet" href="gambling2.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Krona+One&display
=swap" rel="stylesheet">
</head>
<body>
104
<h2>Thanks for your interest on Gambling</h2>
<h3>Our Experts will contact you soon !!!!</h3>
</body>
</html>
css file:
---------
body{
background: #011627;
color:#fdfffc;
text-align: center;
border: 40px solid #2EC486;
border-top: 0px;
margin: 0px;
font-family: 'Krona One', sans-serif;
}
p{
padding-left: 20%;
padding-right: 20%;
padding-top: 5%;
}
form{
font-size: 1.5em;
margin: 20px;
}
#button{
105
height: 70px;
width: 140px;
margin: 10px;
font-size: 1.5em;
background: orange;
border-radius: 25px;
}
sir please clarify ? if we provide 2 links .. then the first link will be
overwridden right ? then how 2 links r working?
6. Blog app:
------------
<div>
A group of tags
</div>
https://css-tricks.com/examples/hrs/
html:
----
106
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>DURGA Blog</title>
<link rel="stylesheet" href="blog2.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Orelega+One&displa
y=swap" rel="stylesheet">
</head>
<body>
<div class="post">
<div class='date'>Apr 30th 2021</div>
<h2>This is Python Related Post</h2>
<p class="mainp">Bacon ipsum dolor amet tongue boudin bacon
ball tip. Bresaola tenderloin shank short loin fatback tail. Doner
venison prosciutto, tri-tip strip steak ham hock ball tip tongue
tenderloin salami ham beef ribs short loin swine hamburger. Flank
bresaola venison turkey, picanha ground round tongue salami
shoulder short loin boudin cupim spare ribs leberkas pancetta. Chuck
andouille venison sausage pig porchetta doner. Flank ball tip tongue
brisket cupim shoulder pig ground round short ribs buffalo tenderloin
meatball pork chop pastrami biltong. Tenderloin pork beef, jowl
swine turkey t-bone.
</p>
<p>
107
Ball tip ham jerky picanha landjaeger. Ribeye ball tip shankle short
ribs jerky shank strip steak cupim picanha bacon drumstick. Buffalo
burgdoggen ham hock landjaeger. Pastrami turducken chicken
andouille shank swine pork tenderloin, alcatra turkey frankfurter
shankle hamburger rump short ribs. Buffalo chicken rump, capicola
porchetta pastrami beef ribs ham hock.
</p>
<p>
Jerky kevin bacon, filet mignon ball tip picanha pancetta biltong
andouille short ribs leberkas. Pastrami jerky turkey rump beef ribs
venison, turducken pork loin leberkas swine spare ribs brisket. Spare
ribs beef ribs fatback tongue prosciutto cupim bacon pastrami ham
jerky short loin. Venison pork belly drumstick cow corned beef
capicola tail jowl porchetta. Corned beef swine filet mignon short ribs
beef ribs ball tip, rump salami jerky tri-tip tail burgdoggen pig ham
pork chop.
</p>
<hr>
</div>
<div class="post">
<div class='date'>May 30th 2021</div>
<h2>This is Django Related Post</h2>
<p class="mainp">Bacon ipsum dolor amet tongue boudin bacon ball
tip. Bresaola tenderloin shank short loin fatback tail. Doner venison
prosciutto, tri-tip strip steak ham hock ball tip tongue tenderloin
salami ham beef ribs short loin swine hamburger. Flank bresaola
venison turkey, picanha ground round tongue salami shoulder short
108
loin boudin cupim spare ribs leberkas pancetta. Chuck andouille
venison sausage pig porchetta doner. Flank ball tip tongue brisket
cupim shoulder pig ground round short ribs buffalo tenderloin
meatball pork chop pastrami biltong. Tenderloin pork beef, jowl
swine turkey t-bone.
</p>
<p>
Ball tip ham jerky picanha landjaeger. Ribeye ball tip shankle short
ribs jerky shank strip steak cupim picanha bacon drumstick. Buffalo
burgdoggen ham hock landjaeger. Pastrami turducken chicken
andouille shank swine pork tenderloin, alcatra turkey frankfurter
shankle hamburger rump short ribs. Buffalo chicken rump, capicola
porchetta pastrami beef ribs ham hock.
</p>
<p>
Jerky kevin bacon, filet mignon ball tip picanha pancetta biltong
andouille short ribs leberkas. Pastrami jerky turkey rump beef ribs
venison, turducken pork loin leberkas swine spare ribs brisket. Spare
ribs beef ribs fatback tongue prosciutto cupim bacon pastrami ham
jerky short loin. Venison pork belly drumstick cow corned beef
capicola tail jowl porchetta. Corned beef swine filet mignon short ribs
beef ribs ball tip, rump salami jerky tri-tip tail burgdoggen pig ham
pork chop.
</p>
<hr>
</div>
109
<div class="post">
<div class='date'>June 30th 2021</div>
<h2>This is Data Science Related Post</h2>
<p class="mainp">Bacon ipsum dolor amet tongue boudin bacon ball
tip. Bresaola tenderloin shank short loin fatback tail. Doner venison
prosciutto, tri-tip strip steak ham hock ball tip tongue tenderloin
salami ham beef ribs short loin swine hamburger. Flank bresaola
venison turkey, picanha ground round tongue salami shoulder short
loin boudin cupim spare ribs leberkas pancetta. Chuck andouille
venison sausage pig porchetta doner. Flank ball tip tongue brisket
cupim shoulder pig ground round short ribs buffalo tenderloin
meatball pork chop pastrami biltong. Tenderloin pork beef, jowl
swine turkey t-bone.
</p>
<p>
Ball tip ham jerky picanha landjaeger. Ribeye ball tip shankle short
ribs jerky shank strip steak cupim picanha bacon drumstick. Buffalo
burgdoggen ham hock landjaeger. Pastrami turducken chicken
andouille shank swine pork tenderloin, alcatra turkey frankfurter
shankle hamburger rump short ribs. Buffalo chicken rump, capicola
porchetta pastrami beef ribs ham hock.
</p>
<p>
Jerky kevin bacon, filet mignon ball tip picanha pancetta biltong
andouille short ribs leberkas. Pastrami jerky turkey rump beef ribs
venison, turducken pork loin leberkas swine spare ribs brisket. Spare
110
ribs beef ribs fatback tongue prosciutto cupim bacon pastrami ham
jerky short loin. Venison pork belly drumstick cow corned beef
capicola tail jowl porchetta. Corned beef swine filet mignon short ribs
beef ribs ball tip, rump salami jerky tri-tip tail burgdoggen pig ham
pork chop.
</p>
<hr>
</div>
</body>
</html>
css:
----
body{
border: 20px solid #bdc3c7;
padding:20px;
width:800px;
margin:20px auto;
font-family: 'Orelega One', cursive;
}
.mainp{
border-left: 5px solid #bdc3c7;
padding-left: 5px;
}
.date{
color:#3498db;
111
text-transform: uppercase;
letter-spacing: 5px;
}
h2{
color:blue;
font-size: 2.0em;
}
.post{
margin-bottom: 20px;
}
hr {
height: 12px;
border: 0;
box-shadow: inset 0 12px 12px -12px rgba(0, 0, 0, 0.5);
}
Bootstrap:
----------
bootstrap.css
----------------
.container{
container related styling
}
112
.jumbotron{
jumbotron related styling
}
getbootstrap.com
113
1. By using CDN (Content Delivery Network)
2. Locally
bootstrap.min.css
bootstrap.css:
--------------
.container{
background: red;
color: white;
}
bootstrap.min.css:
-----------------
.container{ background: red; color: white;}
114
B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCj
EUQouq2+l" crossorigin="anonymous">
2. Locally:
-----------
https://getbootstrap.com/docs/4.6/getting-started/download/
1. Buttons
2. Forms
3. Navbar
4. GRID
115
Bhavani
[email protected]
99 2737 2737
https://drive.google.com/drive/folders/1GoWlJyZ3P2AWjca0XuIfozgl
y5Gs6j3j?usp=sharing
1. Buttons
2. Jumbotron
3. Forms
4. Navbar
5. Grid
1. Buttons:
-----------
2. Jumbotron:
-------------
show case
116
3. Forms:
---------
login form, registration form, enquiry form etc
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1"
aria-describedby="emailHelp" placeholder="Enter email">
<small id="emailHelp" class="form-text text-muted">We'll never
share your email with anyone else.</small>
</div>
117
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control"
id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-group">
<label for="exampleSelect1">Example select</label>
<select class="form-control" id="exampleSelect1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="form-group">
<label for="exampleSelect2">Example multiple select</label>
<select multiple class="form-control" id="exampleSelect2">
118
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="form-group">
<label for="exampleTextarea">Example textarea</label>
<textarea class="form-control" id="exampleTextarea"
rows="3"></textarea>
</div>
<div class="form-group">
<label for="exampleInputFile">File input</label>
<input type="file" class="form-control-file" id="exampleInputFile"
aria-describedby="fileHelp">
<small id="fileHelp" class="form-text text-muted">This is some
placeholder block-level help text for the above input. It's a bit lighter
and easily wraps to a new line.</small>
</div>
119
<!-- RADIO BUTTONS -->
<fieldset class="form-group">
<legend>Radio buttons</legend>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input"
name="optionsRadios" id="optionsRadios1" value="option1"
checked>
Option one is this and that—be sure to include why it's
great
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input"
name="optionsRadios" id="optionsRadios2" value="option2">
Option two can be something else and selecting it will deselect
option one
</label>
</div>
120
<div class="form-check disabled">
<label class="form-check-label">
<input type="radio" class="form-check-input"
name="optionsRadios" id="optionsRadios3" value="option3"
disabled>
Option three is disabled
</label>
</div>
</fieldset>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input">
Check me out
</label>
</div>
</form>
121
1. Buttons
2. Jumbotron
3. Forms
4. Navbar:
----------
Navigation Bar
2020--->Fresher
2017--->4 Years
3+ Years of Exp
1 or 2 calls
4 to 10 calls
122
3 Years Ameerpet experience is more worthy than 3 Years original
real time exp.
To get job several things are required, But to do the job nothing is
required.
Exception--->Fresher/Ameerpet Student
If they want to change the company
Infosys-->
Intermediate but not 10th class
Degree
5+ years
telecom
some projects also
FAQs:
Keeping FAKe
Freshers:
---------
123
1. The chance of getting job is very very low
2. The chance of getting project is very very low
3. 14th player in cricket team
4. The chance of getting onsite opportunity is very very low. almost
impossible.
5. Salary hikes are very low
4. Navbar:
---------
Navbar--->Navigation Bar
124
How to create Navbar Template:
-------------------------------
Default:
--------
<nav class="navbar navbar-expand-lg navbar-light bg-light">
</nav>
Color Schemes:
--------------
<nav class="navbar navbar-dark bg-dark">
<!-- Navbar content -->
</nav>
125
Image and Text
Anachor:
--------
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand"
href="https://www.durgasoftonline.com/">DURGASOFT</a>
</nav>
Heading:
--------
<!-- As a heading -->
<nav class="navbar navbar-light bg-light">
<span class="navbar-brand mb-0 h1">Navbar</span>
</nav>
Image:
------
<a class="navbar-brand" href="https://www.durgasoftonline.com/">
<img src="D.JPG" width="30" height="30" alt="">
</a>
https://www.durgasoftonline.com/logo.png
126
<img src="D.JPG" width="30" height="30" class="d-inline-block
align-top" alt="">
DURGASOFT
</a>
127
How to position navbar items properly:
--------------------------------------
We have to take all navbar items inside container.
<div class='container'>
navbar items
</div>
fixed top:
----------
We have to add fixed-top class.
<nav class="navbar fixed-top navbar-light bg-light">
<a class="navbar-brand" href="#">Fixed top</a>
</nav>
fixed bottom:
------------
<nav class="navbar fixed-bottom navbar-light bg-light">
<a class="navbar-brand" href="#">Fixed bottom</a>
128
</nav>
Sticky top:
-----------
<nav class="navbar sticky-top navbar-light bg-light">
<a class="navbar-brand" href="#">Sticky top</a>
</nav>
step-2:
-------
To add hamburger, we have to add the following <button> tag after
brand.
129
</button>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-
DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+O
rCXaRkfj" crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap
.bundle.min.js" integrity="sha384-
Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfG
II0yAns" crossorigin="anonymous"></script>
Bootstrap
Buttons
Jumbotron
Forms
Navbar
GRID System:
130
------------
LCD
Desktop
Laptop
Tab
Mobile
131
2. Within the row we can define columns by using
col-screensize-noOfColumns
<div class='row'>
<div class='col-lg-3'>Element1</div>
</div>
132
On large screen each element has to take 3 columns length.
<div class='row'>
<div class='col-lg-3'>Element1</div>
<div class='col-lg-3'>Element2</div>
<div class='col-lg-3'>Element3</div>
<div class='col-lg-3'>Element4</div>
</div>
case-1: 3 elements
e1--->3 columns
e2--->6 columns
e3--->3 columns
<div class='row'>
<div class='col-lg-3'>Element1</div>
<div class='col-lg-3'>Element2</div>
<div class='col-lg-3'>Element3</div>
</div>
case:
For medium or large screens each row should contain 4 elements
<div class='row'>
133
<div class='col-md-3 box'>Element1</div>
<div class='col-md-3 box'>Element2</div>
<div class='col-md-3 box'>Element3</div>
<div class='col-md-3 box'>Element4</div>
</div>
<div class='row'>
<div class='col-4 box'>Element1</div>
<div class='col-4 box'>Element2</div>
<div class='col-4 box'>Element3</div>
</div>
134
col-lg-2 col-md-3 col-sm-4 col-xs-6
<div class='row'>
<div class='col-lg-2 col-md-3 col-sm-4 col-xs-6
box'>Element1</div>
<div class='col-lg-2 col-md-3 col-sm-4 col-xs-6
box'>Element2</div>
<div class='col-lg-2 col-md-3 col-sm-4 col-xs-6
box'>Element3</div>
<div class='col-lg-2 col-md-3 col-sm-4 col-xs-6
box'>Element4</div>
<div class='col-lg-2 col-md-3 col-sm-4 col-xs-6
box'>Element5</div>
<div class='col-lg-2 col-md-3 col-sm-4 col-xs-6
box'>Element6</div>
</div>
https://drive.google.com/drive/folders/1GoWlJyZ3P2AWjca0XuIfozgl
y5Gs6j3j?usp=sharing
Buttons
Jumbotron
Forms
Navbar and Hamburger
GRID
135
Nested GRID:
------------
Grid inside Grid
<div class="container">
<div class='row'>
<div class='col-6 box'>
<div class="row ">
<div class='col-3 box'>Element1A</div>
<div class='col-3 box'>Element1B</div>
<div class='col-3 box'>Element1C</div>
<div class='col-3 box'>Element1D</div>
</div>
</div>
<div class='col-6 box'>
<div class="row ">
<div class='col-4 box'>Element2A</div>
<div class='col-4 box'>Element2B</div>
<div class='col-4 box'>Element2C</div>
</div>
</div>
</div>
136
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootst
rap.min.css" integrity="sha384-
B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCj
EUQouq2+l" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-
DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+O
rCXaRkfj" crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap
.bundle.min.js" integrity="sha384-
Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfG
II0yAns" crossorigin="anonymous"></script>
sir class=" col-lg-3 col-6 " explain this sir once again ?
137
HTML
CSS
Bootstrap
unsplash
138
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.</p>
<h2>We are very specialized for</h2>
<ul>
<li>Late Marriages</li>
<li>Early Marriages</li>
<li>xyz Marriages</li>
<li>abc Marriages</li>
<li>zzz Marriages</li>
</ul>
https://www.w3schools.com/howto/
i want to ask that we have already java python and other languages
.then what is the requirement of the scripting laguages??
HTML
CSS
Bootstrap
----------
Java Script:
------------
To add functionality to the HTML components
139
Full Stack---->Any database+Front+Java|Django
MEAN Stack---->MongoDB+Express JS+Angular+Node
MERN Stack----->MongoDB+Express JS+React+Node
How to launch:
Browser-->Right click-->Inspect--->Console
140
ctrl+shift+j or F12
10
10.5
-10
10+20
10-20
20/10
20*10
10**2
2. string:
----------
141
any sequence of characters either within single quotes or double
quotes
'durga'
"durga"
+ operator===>concatenation
'durga'+'soft'--->durgasoft
'durga'+10--->durga10
'durga'+true--->durgatrue
142
s[2]
s[10]
boolean:
-------
true/false
True/False
number
string
boolean
x = 10
143
student_mobile_number-->snake case(Python)
student-mobile-number--->Kebab Case(LISP)
1. number
2. string
3. boolean
4. undefined
5. null
null means nothing
If the value of a variable is null means it is not pointing to any value.
currentplayer = null
https://flowup.000webhostapp.com/ --->Ram
https://manishp.000webhostapp.com/ --->Manish
https://jalapic-orifices.000webhostapp.com/admins/login
144
The 3 most commonly used methods of java script:
------------------------------------------------
1. alert()
2. console.log()
3. prompt()
1. alert():
-----------
To display alerts to the end user.
alert(100+250)
2. console.log()
----------------
To print messages to the developers console
console.log('Hello Friends...')
145
console.log(10*20)
3. prompt()
-----------
name = input('Enter Your Name:')--->Python
1. alert()
2. console.log()
3. prompt()
146
-----------------------------------------------------------------------
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap
.bundle.min.js" integrity="sha384-
Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfG
II0yAns" crossorigin="anonymous"></script>
https://annaamma.000webhostapp.com/
https://lawless-screens.000webhostapp.com/
147
today i have completed app to my client in upwork sir and completed
and got psymeny sir
Operators:
----------
1. Arithmetic Operators:
+,-,*,/,%,**
10<20
10<=20
10>20
10>=20
10==20
10 !=20
148
Difference between == and ===:
------------------------------
== operator is equality operator
=== operator is strict equality operator
10 == 10
10 == '10'
10 == 10.0
true == '1'
false == '0'
null == undefined
149
true === '1'
false === '0'
null === undefined
10<NaN
10<=NaN
10>NaN
10>=NaN
10 == NaN
NaN == NaN
10 != NaN
NaN != NaN
true answer
0/1 == NaN
Logical Operators:
-----------------
&& --->AND
150
|| -->OR
! ---->NOT
x = 10
y = 20
Conditional statements:
-----------------------
1. if
2. if -else
3. if-else if
151
Syntax:
-----
if (b){
action if b is true
}
else{
action if b is false
}
number('10')+'20'
console.log(string)
console.log('The given Number is:'+x+' It is even')
152
Matrimonial website:
--------------------
age from the end user
18 to 60 years
-----------------------
read brand from the end user and provide meaningful message.
153
alert('It is too light')
}
else if(brand == 'RC'){
alert('It is not that much kick')
}
else if(brand == 'FO'){
alert('Buy one get One FREE')
}
else{
alert('Other brands are not recommended')
}
Iterative Statements:
154
---------------------
to execute a group of statements iteratively... iterative statements
2 iterative statements
1. while loop
2. for loop
1. while loop:
-------------
as long as some condition is true, then we should go for while loop.
Syntax:
while(condition){
body
}
155
u
r
g
a
2X1=2
2X2=4
156
while (n <= 100){
if( n%3 == 0 && n%5 == 0){
console.log(n)
}
n++
}
Syntax:
------
for(initialization_section;conditional_check;increment_decrement_se
ction){
body
}
157
console.log('Hello')
}
while vs for:
-------------
158
If we dont know number of iterations in advance and as long as some
condition is true, execute body...while loop
'7' == 7
ameer
5
0,1,2,3,4
actor[4]
159
var name = prompt('Enter Your Name:')
var actor = prompt('Enter Your Favourite Actor Name:')
var lucky = prompt('Enter Your Lucky Number:')
var dish = prompt('Enter Your Favourite Dish:')
if (name[0] == 'd'){
nameCondition = true
}
if (lucky == 7){
luckyCondition = true
}
160
console.log('Hello Secret Agent, Our next operation is:')
console.log('We have to kill atleast 10 sleeping students in the class
roon because these people are burdent to the country')
}
actor = 'ameer'
actor.length --->5
actor[0] --->a
actor[1] --->m
actor[2] --->e
actor[3] --->e
actor[4] --->r
actor[0]
Functions:
-----------
function functionName(arguemnts){
line-1
line-2
line-3
161
line-4
line-5
}
functionName()
functionName()
functionName()
functionName()
Code reusability
Syntax:
function functionName(arguemnts){
body
return value
}
function wish(name){
console.log('Hello '+name+'... Good Evening!!!')
162
}
wish('Durga')
wish('Veeru')
wish()
wish('Veeru')
function squareIt(num){
return num*num
}
163
2. to take 2 numbers as arguments and return sum???
function sum(num1,num2){
return num1+num2
}
function capitalize(str){
result = str[0].toUpperCase()+str.slice(1)
return result
}
console.log(capitalize('apple'))
164
}
}
console.log(isEven(15))
console.log(isEven(10))
function snakeToKebad(str){
var newStr = str.replaceAll('_','-')
return newStr
165
}
console.log(snakeToKebad('durga_software_solutions'))
The variables are which are declared outside of function are having
global scope and available for all functions.
The variables are which are declared inside function are having local
scope and available only for that function.
166
f1()
f2()
Q. If local and global variables having same name then within the
function local variable will get high priority. How to access global
variable value??
setInterval(function, time_in_milliseconds)
clearInterval(1)
Anonymous functions:
--------------------
nameless function
167
just for instant use
x = 777
function f1()
{
var x = 10
console.log(x)
console.log(this.x)
}
f1()
x = 777
function f1()
{
var x = 10
console.log(x)
console.log(this.x)
console.log(window.x)
}
f1()
168
How to access global variables inside a function, if both global and
local variables have same name?
x = 777
function f1()
{
var x = 10
console.log(x)
console.log(this.x)
console.log(window.x)
}
f1()
Coding Examples :
----------------
Problem-1: sleep_in
169
function sleep_in(weekday,vacation){
if (weekday == false) {
return true
}
else if(vacation == true){
return true
}
return false
}
console.log('Is Employee Sleeping:'+ sleep_in(true,true)) //true
console.log('Is Employee Sleeping:'+ sleep_in(true,false))//false
console.log('Is Employee Sleeping:'+ sleep_in(false,true))//true
console.log('Is Employee Sleeping:'+ sleep_in(false,false))//true
2nd way:
function sleep_in(weekday,vacation){
return !weekday || vacation
}
console.log('Is Employee Sleeping:'+ sleep_in(true,true)) //true
console.log('Is Employee Sleeping:'+ sleep_in(true,false))//false
console.log('Is Employee Sleeping:'+ sleep_in(false,true))//true
console.log('Is Employee Sleeping:'+ sleep_in(false,false))//true
Problem-2: monkey_trouble:
--------------------------
170
We have two monkeys, a and b, and the parameters a_smile and
b_smile indicate if each is smiling. We are in trouble if they are both
smiling or if neither of them is smiling. Return True if we are in
trouble.
171
2nd way:
--------
function monkey_trouble(a_smile, b_smile){
return (a_smile && b_smile) || (!a_smile && !b_smile)
}
console.log('Is Person in trouble:'+monkey_trouble(true,true)); //true
console.log('Is Person in trouble:'+monkey_trouble(false,false));
//true
console.log('Is Person in trouble:'+monkey_trouble(true,false));//false
Problem-3: string_times :
-----------------------------------
Given a string and a non-negative int n, return a larger string that is n
copies of the original string. ie string repeatition operator.
function string_times(str,n){
result=''
count=1
while (count <= n){
result = result+str
count++
}
172
return result
}
console.log(string_times('durga',3));
console.log(string_times('hello',2));
console.log(string_times('hi',1));
function string_times(str,n){
result=''
for (var i = 0; i < n; i++) {
result += str
}
return result
}
console.log(string_times('durga',3));
console.log(string_times('hello',2));
console.log(string_times('hi',4));
Problem-4: lucky_sum :
--------------------------------
Given 3 int values, a b c, return their sum. However, if one of the
values is 13 then it does not count towards the sum and values to its
right do not count. So for example, if b is 13, then both b and c do not
count.
lucky_sum(1, 2, 3) --> 6
173
lucky_sum(1, 2, 13) --> 3
lucky_sum(1, 13, 3) --> 1
lucky_sum(13, 13, 3) --> 0
function lucky_sum(a,b,c){
if (a==13){
return 0;
}
else if(b==13){
return a;
}
else if(c == 13){
return a+b
}
else{
return a+b+c
}
}
console.log(lucky_sum(1, 2, 3)); //6
console.log(lucky_sum(1, 2, 13));//3
console.log(lucky_sum(1, 13, 3));//1
console.log(lucky_sum(13, 13, 3));//0
ternary operator:
-----------------
result = (condition)? x: y
174
if condition is true then x value will be considered else y value will be
considered.
2nd way:
function lucky_sum(a,b,c){
return (a==13)? 0:(b==13)?a:(c==13)?a+b:a+b+c
}
console.log(lucky_sum(1, 2, 3)); //6
console.log(lucky_sum(1, 2, 13));//3
console.log(lucky_sum(1, 13, 3));//1
console.log(lucky_sum(13, 13, 3));//0
console.log('Superb way!!!');
Problem-5: caught_speeding
-------------------------------------
You are driving a little too fast, and a police officer stops you. Write
code to compute the result, encoded as an int value: 0=no ticket,
1=small ticket, 2=big ticket. If speed is 60 or less, the result is 0. If
speed is between 61 and 80 inclusive, the result is 1. If speed is 81 or
more, the result is 2. Unless it is your birthday -- on that day, your
speed can be 5 higher in all cases.
175
caught_speeding(65, False) --> 1
caught_speeding(65, True) --> 0
60--->no ticket
65--->no ticket if birthday
176
JavaScript Arrays:
------------------
An indexed collection of elements.
x=10
y=20
z=30
numbers = [10,20,30]
if we are trying to access array element with out of range index, then
we won't get any error and just we will get undefined.
negative indexing is not supported.
177
friends[0] = 'durga'
numbers.length
178
Important methods related to javascript arrays:
-----------------------------------------------
1. push()
2. pop()
3. unshift()
4. shift()
5. indexOf()
6. slice()
1. push()
---------
We can use push() method to add elements at the end of array. After
addding this element it returns the length of the array.
2. pop():
---------
To remove and return last element of the array.
var numbers = [10,20,30,40,50]
console.log(numbers.pop())
console.log(numbers.pop())
console.log(numbers.pop())
console.log(numbers);
179
3. unshift():
-------------
To add element at beginning of the array. counter part of push
operation.
4. shift:
--------
counter part to pop operation.
To remove and return first element from the array.
5. indexOf():
-------------
We can use indexOf() to find index of specified element.
if the element present multiple times then it will return index of first
occurrence.
180
var numbers = [10,20,30,40,50,30]
console.log(numbers.indexOf(70));
6. slice():
----------
To get part of the array
slice(begin,end)---->returns array elements from begin index to end-1
index.
slice()---->returns all elements.
181
--------------------------------------
var numbers = [[10,20,30],[40,50,60],[70,80,90]]
console.log(numbers);
console.log(numbers[0][2]);
console.log(numbers[2][1]);
182
How to retrieve elements of the array:
--------------------------------------
We can retrieve elements of the array by using the following ways:
1. while loop
2. for loop
3. for-of loop
4. forEach loop
https://register5566.000webhostapp.com/
1. while loop:
--------------
nums = [10,20,30,40,50]
var i =0
while(i<nums.length){
183
console.log(nums[i]);
i++; // i = i+1
}
2. for loop:
------------
nums = [10,20,30,40,50,60]
for (var i = 0; i < nums.length; i++) {
console.log(nums[i])
}
3. for-of loop:
---------------
nums = [10,20,30,40,50,60,70]
for (num of nums) {
console.log(num)
}
4. forEach() method:
---------------------
It is specially designed method to retrieve elements of array.
arrayObject.forEach(function)
heroines = ['sunny','mallika','katrina','kareena','kajal']
function printElement(element) {
184
console.log('********************');
console.log(element);
console.log('********************');
}
heroines.forEach(printElement)
// for each element present in the heroines array, printElement
function will be executed by passing that element as argument.
eg-2:
heroines = ['sunny','mallika','katrina','kareena','kajal']
heroines.forEach(function(element) {
console.log('********************');
console.log(element);
console.log('********************');
})
// for each element present in the heroines array, printElement
function will be executed by passing that element as argument.
heroines = ['sunny','mallika','katrina','kareena','kajal']
heroines.forEach(console.log)
// for each element present in the heroines array, concole.log()
function will be executed by passing that element as argument.
185
heroines = ['sunny','mallika','katrina','kareena','kajal']
heroines.forEach(alert)
// for each element present in the heroines array, alert() function will
be executed by passing that element as argument.
heroines = ['sunny','mallika','katrina','kareena','kajal']
for (var i = 0; i < heroines.length; i++) {
console.log(heroines[i])
}
console.log('****************');
for (var i = heroines.length-1; i >= 0; i--) {
console.log(heroines[i])
}
186
splice() function
arrayobject.splice(index,number of elements)
arrayobject.splice(2,1)
arrayobject.splice(2,2)
heroines = ['sunny','mallika','katrina','kareena','kajal']
heroines.splice(2,2)
console.log(heroines);
heroines[2]='xyz'
Immutability vs mutability:
---------------------------
arrays are mutable. vs but string objects are immutable.
187
Once we creates string object, we are not allowed to change its
content in the existing object. If we are trying to change, with those
changes a new object will be created.
heroines = ['sunny','mallika','katrina','kareena','kajal']
heroines[0]='xyz'
console.log(heroines);
name = 'sunny'
name[0]='B'
console.log(name);
name = 'sunny'
name.toUpperCase()
console.log(name);
function reverse(array) {
188
for (var i = array.length-1; i >=0; i--) {
console.log(array[i]);
}
}
reverse([10,20,30,40])
reverse(['A','B','C','D','E'])
function identical(array) {
first=array[0]
for (var i = 1; i < array.length; i++) {
if (array[i] != first) {
return false
}
}
return true
}
console.log(identical([10,10,10,10]))
console.log(identical([10,10,10,30,10,10]))
function findMax(array) {
189
max=array[0]
for (var i = 1; i < array.length; i++) {
if (array[i] > max) {
max = array[i]
}
}
return max
}
console.log(findMax([10,5,4,15,9]))
190
Book Management Application:
----------------------------
books = []
input = prompt('Which Operation You want to
perform[add|delete|list|exit]')
while (input != 'exit'){
if (input == 'add'){
addBook();
}
else if( input == 'list' ){
listBooks();
}
else if(input == 'delete'){
deleteBook();
}
else{
console.log('Invalid Option, Please Enter Valid Option');
}
input = prompt('Which Operation You want to
perform[add|delete|list|exit]')
}
191
console.log('Thanks for using our application');
function addBook(){
newBook = prompt('Enter the name of the book to add')
books.push(newBook)
console.log('Specified Book added');
}
function listBooks(){
console.log('List of Available Books:');
for (book of books) {
console.log(book);
}
}
function deleteBook(){
name = prompt('Enter the name of book to delete:')
index = books.indexOf(name)
if (index == -1) {
console.log('Specified Book is not available');
}
else{
books.splice(index,1)
console.log('Specified Book deleted');
}
}
JavaScript Objects:
-------------------
192
xml
json/yaml
import requests
r=requests.get('https://api.coindesk.com/v1/bpi/currentprice.json')
data=r.json()
print('Hello Friends, If you required bit coin price,please contact me')
print(f"As on {data['time']['updated']}, Bitcoin price:
${data['bpi']['USD']['rate']}")
JavaScript Objects:
-------------------
Array--->we can store a group of individual objects.
Object--> A group of key-value pairs
Syntax:
var variableName = {
key1:value1,
key2:value2,
key3:value3,
...
}
var movie={
name:'Bahubali',
193
year:2016,
hero:'Prabhas',
latest_movie
latestMovie
}
console.log(typeof(movie))
console.log(movie)
2. obj.key
eg: movie.name
1st way:
nums['fno']=100
nums['sno']=200
194
nums['tno']=300
2nd way:
nums.fno=400
If the specified key is already available, then old value will be replaced
with new value.
Iterating Objects:
------------------
var nums = {fno:100,sno:200,tno:300}
for(key in nums){
//console.log(key) //only keys
//console.log(nums[key]); only values
console.log(key+'----->'+nums[key]);
}
195
var movies = [
{name:'Bahubali',year:2016,hero:'Prabhas'},
{name:'Spider',year:2017,hero:'MaheshBabu'},
{name:'Sanju',year:2018,hero:'Ranveer'}
]
movies[0].name
movies[3].hero
movies.name
which name displayed sir
var numbers = {
fg: [10,20,30],
sg: [40,50,60],
tg: [70,80,90]
}
numbers.sg[1]
Object Methods:
---------------
196
Inside object, we can take methods also.
var myObj={
A:'Apple',
B:'Banana',
m1:function(){
console.log('Object Method')
}
}
myObj.m1()
this keyword:
-------------
this means current object
var myObj={
A:'Apple',
B:'Banana',
m1:function(){
console.log('First Fruit:'+this.A)
console.log('Second Fruit:'+this.B)
}
}
197
function demo(){
console.log('Demo Function');
}
var movie={
name:'Bahubali',
year:2016,
hero:'Prabhas',
getInfo:demo
}
function demo(){
console.log('Movie Name:'+this.name);
console.log('Year of Release:'+this.year);
console.log('Hero Name:'+this.hero);
}
var movie={
198
name:'Bahubali',
year:2016,
hero:'Prabhas',
getInfo:demo
}
movie.getInfo()
demo()
var movie={
name:'Bahubali',
year:2016,
hero:'Prabhas',
getInfo: function demo(){
console.log('Movie Name:'+this.name);
console.log('Year of Release:'+this.year);
console.log('Hero Name:'+this.hero);
}
}
199
var movie={
name:'Bahubali2',
year:2018,
hero:'Prabhas',
getInfo(){
console.log('Movie Name:'+this.name);
console.log('Year of Release:'+this.year);
console.log('Hero Name:'+this.hero);
}
}
var movie={
name:'Bahubali2',
year:2018,
hero:'Prabhas',
getInfo(a){
console.log('Movie Name:'+this.name);
console.log('Year of Release:'+this.year);
console.log('Hero Name:'+this.hero);
console.log('Rating:'+a);
}
}
200
movie.getInfo(5)
result='I '
var fruits=['Apple','Banana','Orange']
fruits.forEach(function(fruit){
if (fruit=='Apple')
{
console.log('It is too good for health')
}
})
Mini Application:
201
-------------------
var movies =[
{name:'Bahubali',isWatched:true,isHit:false},
{name:'Sanju',isWatched:true,isHit:false},
{name:'Spider',isWatched:true,isHit:false},
{name:'VakeelSab',isWatched:true,isHit:true},
]
movies.forEach(function(movie){
result ='I '
if (movie.isWatched) {
result=result+'watched '
}
else{
result=result+'have not seen '
}
result=result+movie.name+' and Movie is '
if (movie.isHit) {
result=result+'Hit!!!'
}
else{
result=result+'Flop!!!'
}
console.log(result);
})
202
HTML
CSS
Bootstrap
JS
---------------
DOM
---
DOM--->Document Object Model
3000
title = document.querySelector('title')
links = document.querySelectorAll('a')
for (link of links){
link.textContent='Sunny Leone';
link.style.color='white';
link.style.background='red'
}
203
If javascript required any html component, then it will contact DOM,
which provides the corresponding element.
document.getElementById()
Returns element with the specified id
204
document.getElementsByClassName()
Returns list of elements belongs to the specified class
document.getElementsByTagName()
Returns list of all elements with the specified tag
document.querySelector()
Returns the first object matching CSS style selector
document.querySelectorAll()
Returns aa objects matching CSS style selector
<h1> ---1
<h2> --->2
<li> --->9
class first--->2
id special--->1
.first{
color:red;
}
#special{
color:blue;
}
205
h1+p{
}
document.getElementById('special')
document.getElementsByClassName('first')
document.getElementsByClassName('first')[0]
document.getElementsByClassName('first')[0]
document.getElementsByTagName('h2')
document.querySelector('#special')
document.querySelector('.first')
document.querySelectorAll('.first')
document.querySelectorAll('.first')[0]
document.querySelector('h1+p')
document.getElementsByTagName('p')
206
if i hv both id as well as class for tag , then what to take in
queryselector()?
1. document.getElementById('first')
2. document.getElementsByClassName('special')[0]
3. document.getElementsByTagName('p')[0]
4. document.querySelector('#first')
5. document.querySelector('.special')
6. document.querySelectorAll('#first')[0]
7. document.querySelectorAll('.special')[0]
8. document.querySelector('h1+p')
9. document.querySelectorAll('h1+p')[0]
10. document.querySelector('p#first')
document.getElementById()
Returns element with the specified id
207
document.getElementsByClassName()
Returns list of elements belongs to the specified class
document.getElementsByTagName()
Returns list of all elements with the specified tag
document.querySelector()
Returns the first object matching CSS style selector
document.querySelectorAll()
Returns aa objects matching CSS style selector
Math.random()--->from [0,1)
#035efc
0*16--->0
max--->0.99*16--->15.84
floor(15.84)--->15
test.html:
208
----------
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>This is My Title</title>
</head>
<body>
<h1>Important Methods and Attributes of DOM</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.</p>
<h2>Favourite Food:</h2>
<ul>
<li class='first'>Chicken</li>
<li>Mutton</li>
<li>Fish</li>
<li id='special'>Any animal including human being</li>
</ul>
<h2>Favourite Drink:</h2>
<ul>
<li class='first'>KingFisher</li>
<li>Knock out</li>
<li>Milk</li>
209
<li>Thumsup</li>
<li>Blood</li>
</ul>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.</p>
<a href="https://www.youtube.com/durgasoftware">View
profile</a>
<script type='text/javascript' src='test.js'></script>
</body>
</html>
test.js:
--------
var h1 = document.querySelector('h1')
var p1 = document.querySelectorAll('p')[0]
var p2 = document.querySelectorAll('p')[1]
var h21 = document.querySelectorAll('h2')[0]
var h22 = document.querySelectorAll('h2')[1]
var ul1 = document.getElementsByTagName('ul')[0]
var ul2 = document.getElementsByTagName('ul')[1]
function getRandomColor(){
210
letters = '0123456789ABCDEF'
color = '#'
for (var i = 0; i < 6; i++) {
r = Math.floor(Math.random()*16)
color = color+letters[r]
}
return color
}
function changeColor(){
h1.style.color = getRandomColor()
p1.style.color = getRandomColor()
p2.style.color = getRandomColor()
h21.style.color = getRandomColor()
h22.style.color = getRandomColor()
ul1.style.color = getRandomColor()
ul2.style.color = getRandomColor()
document.body.style.background=getRandomColor()
}
setInterval(changeColor,1000)
211
BY using DOM, we can change text,html code and attributes.
document.body.style.background='red'
212
How to change logo:
-------------------
https://www.durgasoftonline.com/logo.png
logo = document.querySelector('img')
logo.setAttribute('src','https://www.durgasoftonline.com/logo.png')
link = document.querySelector('a')
link.setAttribute('href','https://www.durgasoftonline.com')
Listener--->listens events
whenever a particular event occurs automatically listener will perform
required activity.
213
myh1.addEventListener('click',colorChanger)
myh1 = document.querySelector('h1')
myh1.addEventListener('mouseover',function(){
myh1.textContent='HYDERABAD'
214
myh1.style.color='blue'
})
myh1.addEventListener('mouseout',function(){
myh1.textContent='BANGALORE'
myh1.style.color='red'
})
215
test.js:
--------
function getRandomColor(){
letters = '0123456789ABCDEF'
color = '#'
for (var i = 0; i < 6; i++) {
r = Math.floor(Math.random()*16)
color = color+letters[r]
}
return color
}
var b = document.querySelector('button')
b.addEventListener('click',function(){
document.body.style.background=getRandomColor()
})
test.html:
---------
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>This is My Title</title>
216
</head>
<body>
<h1>Name and Color Changer Application</h1>
<script type='text/javascript' src='test.js'></script>
</body>
</html>
test.js:
---------
function getRandomColor(){
letters = '0123456789ABCDEF'
color = '#'
for (var i = 0; i < 6; i++) {
r = Math.floor(Math.random()*16)
color = color+letters[r]
}
return color
}
function getRandomName(){
names = ['SUNNY
LEONE','MALLIKA','KATRINA','KAREENA','DEEPIKA','PRIYANKA','SAMA
NTHA']
index = Math.floor(Math.random() * names.length)
return names[index]
}
myh1 = document.querySelector('h1')
217
myh1.addEventListener('mouseover',function(){
myh1.textContent = getRandomName()
myh1.style.color = getRandomColor()
})
myh1.addEventListener('mouseout',function(){
myh1.textContent = getRandomName()
myh1.style.color = getRandomColor()
})
function getRandomColor(){
letters = '0123456789ABCDEF'
color = '#'
for (var i = 0; i < 6; i++) {
r = Math.floor(Math.random()*16)
color = color+letters[r]
}
return color
}
function getRandomName(){
names = ['SUNNY
LEONE','MALLIKA','KATRINA','KAREENA','DEEPIKA','PRIYANKA','SAMA
NTHA']
index = Math.floor(Math.random() * names.length)
return names[index]
}
218
myh1 = document.querySelector('h1')
myh1.addEventListener('mouseover',function(){
name = getRandomName()
if (name == 'SUNNY LEONE') {
color='pink'
} else if (name == 'MALLIKA') {
color='orange'
}
else if (name == 'KATRINA') {
color='red'
}
else if (name == 'KAREENA') {
color='blue'
}
else if (name == 'DEEPIKA') {
color='cyan'
}
else if (name == 'PRIYANKA') {
color='magenta'
}
else if (name == 'SAMANTHA') {
color='green'
}
myh1.textContent = name
myh1.style.color = color
})
219
myh1.addEventListener('mouseout',function(){
name = getRandomName()
if (name == 'SUNNY LEONE') {
color='pink'
} else if (name == 'MALLIKA') {
color='orange'
}
else if (name == 'KATRINA') {
color='red'
}
else if (name == 'KAREENA') {
color='blue'
}
else if (name == 'DEEPIKA') {
color='cyan'
}
else if (name == 'PRIYANKA') {
color='magenta'
}
else if (name == 'SAMANTHA') {
color='green'
}
myh1.textContent = name
myh1.style.color = color
})
220
myh1.textContent='DURGASOFT'
<h1>DURGASOFT</h1>
myh1.innerHTML='<h2>Hello Friends</h2>'
<h2>Hello Friends</h2>
221
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootst
rap.min.css" integrity="sha384-
B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCj
EUQouq2+l" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>DURGASOFT TIC TAC TOE GAME</h1>
<p>Be Ready to play to Improve Logical thinking</p>
<button id="b" type="button" name="button" class="btn btn-
primary btn-large">Restart Game</button>
</div>
</div>
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
222
<td></td>
<td></td>
</tr>
</table>
tt.css:
------
.container .jumbotron{
background: red;
color:yellow;
text-align: center;
}
table{
margin: auto;
}
td{
height: 100px;
width: 100px;
border: 5px solid red;
font-size: 50px;
text-align: center;
}
ttt.js:
223
-------
var restartbutton = document.getElementById('b')
var cells = document.querySelectorAll('td')
function clearAllCells(){
for (var i = 0; i < cells.length; i++) {
cells[i].textContent=''
}
}
restartbutton.addEventListener('click',clearAllCells)
function changeContent(){
content=this.textContent
if (content == '') {
this.textContent='X'
}
else if (content=='X') {
this.textContent='O'
}
else if (content == 'O') {
this.textContent=''
}
}
for (cell of cells) {
cell.addEventListener('click',changeContent)
}
224
For mini project on ttt developement:
https://www.geeksforgeeks.org/simple-tic-tac-toe-game-using-
javascript/
HTML
CSS
JS
DOM
jQuery:
-------
jquery.com
225
handling, animation, and Ajax much simpler with an easy-to-use API
that works across a multitude of browsers. With a combination of
versatility and extensibility, jQuery has changed the way that millions
of people write JavaScript.
jQuery:
-------
$('h1').css('color','red')
1. locally or 2. By CDN
226
Limitations of jQuery:
----------------------
1. jQuery won't do any extra activity.
2. performance problems
youmightnotneedjquery.com
jQuery Selectors:
-----------------
Vanilla Java script:
getElementById()
getElementsByClassName()
getElementsByTagName()
querySelector()
querySelectorAll()
$ ===>querySelectorAll()
$('h1') ===>document.querySelectorAll('h1')
227
Manipulate HTML Elements:
-------------------------
element selector
id selector
class selector
* selector
Descendant selector
Adjucent selector
attribute selector
nth-of-type selector
$(selector).css(property,value)
$('h1').css('color','white')
$('h1').css('background','red')
$('h1').css('border','5px solid green')
var x = $('h1')
x.css('color','white')
x.css('background','red')
228
x.css('border','5px solid green')
var x = $('h1')
var myCSS={
color: 'white',
background: 'green',
border: '5px solid red'
}
x.css(myCSS)
$('h1').css({
color: 'white',
background: 'green',
border: '5px solid red'
})
$('h1')--->querySelectorAll()
229
How to select a particular HTML element instead of all matched
elements:
------------------------------------------------------------------------
$('element')---->All matched html elements.
eg:
$('h1').css('color','red')--->Select all h1 tags
$('h1:first').css('color','red')--->selects only first h1
$('h1').first().css('color','red')--->selects only first h1
$('h1:first-of-type').css('color','red')--->selects only first h1
$('h1:nth-of-type(1)').css('color','red')--->selects only first h1
$('h1:nth-of-type(3)').css('color','red')--->selects only 3rd h1
$('h1:last').css('color','red')--->selects only last h1
$('h1').last().css('color','red')--->selects only last h1
$('h1:nth-of-type(even)').css('color','red')--->selects only even h1
$('h1:nth-of-type(odd)').css('color','red')--->selects only odd h1
Q1. Write Vanilla java script and jQuery code to change all h1 tags text
color as white and background as red?
230
Vanilla java script:
--------------------
var allh1= document.querySelectorAll('h1')
for(h1 of allh1){
h1.style.color='white';
h1.style.background='red';
}
jQuery code:
-----------
var mystyle={
color:'white',
background:'red'
}
$('h1').css(mystyle)
Instead of this
$('h1').css({
color:'white',
background:'red'
})
Q2. Write vanilla javascript and jquery code to set all li tags font size
as 20px?
231
for(li of allli){
li.style.fontSize='50px';
}
jQuery:
-------
$('li').css('fontSize','50px')
Demo Application:
------------------
demo.html:
----------
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js"
integrity="sha256-
u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="
crossorigin="anonymous"></script>
</head>
<body>
<p> This is the first paragraph</p>
<p id='second'> This is the second paragraph</p>
<p class="remaining"> This is the third paragraph</p>
232
<p class="remaining"> This is the fourth paragraph</p>
</body>
</html>
Q2. Select all p tags with class 'remaining' and make them 200px
width
$('p').css('background','green')
$('.remaining').css('width','200px')
Q3. Select all <p> tags with id='second' and give red solid 10px
border?
$('#second').css('border','10px solid red')
Q4. Select only third <p> tag and change font size as 30px?
$('p:nth-of-type(3)').css('fontSize','30px')
233
7. toggleClass()
1. text():
----------
We can use this method to get or set text content of matched
elements.
It acts as both getter and setter method.
$('h1').text()
"This is h1 tag"
2. html()
---------
Get the HTML contents of the first element in the set of matched
elements or set the HTML contents of every matched element.
234
$('h1').html()
$('li').html()
$('li').html('<a href="https://amazon.com">Amazon</a>')
<a href='https://amazon.com'>Amazon</a>
3. attr():
----------
attr --->attribute
Get the value of an attribute for the first element in the set of
matched elements or
235
If the specified attribute is not already available then this new
attribute will be set.
element.attr(attributename,attributevalue)--->setter method
<img src='durga.jpg'>
$('img').attr('src')--->durga.jpg
$('img').attr('src','sunny.jpg')
$('img').attr('height',50px)
$('img').css({height:'150px',width:'150px'})
236
1. To get src attribute value of the first image:
$('img').attr('src')
Get the value of an attribute for the first element in the set of
matched elements or set one or more attributes for every matched
element
$('img')
$('#first')
In css:
237
1. element selectors
2. id selectors
3. class selectors
4> * selector
5. adjacent selector
6. descendant selector
7. nth of type selector
238
$('input').attr('type','checkbox')
1. text()
2. html()
3. attr()
4. val():
---------
Get the current value of the first element in the set of matched
elements or set the value of every matched element.
eg:
value entered in the text box
which radio button selected
which value selected from the dropdown box
239
2. To get value provided by enduser for the second input tag?
$('input:nth-of-type(2)').val()
$('input:nth-of-type(2)').val('sunny')
$('select').val('datascience')
css class
240
eg-2: For every even li, remove high class
$('li:nth-of-type(even)').removeClass('high')
https://api.jquery.com/category/events/
1. click()
2. keypress()
3. on()--->general purpose method
1. click():
----------
241
We can use click() method to add click listener to the element.
$('h1').click(function(){
alert('h1 tag got clicked')
})
$('button').click(function(){
alert('Hello dont sleep');
$(this).css('background','red');
})
demo.html:
-----------
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js"
integrity="sha256-
242
u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="
crossorigin="anonymous"></script>
</head>
<body>
<h1>jQuery Event Handling Demo</h1>
<button type="button" name="button">Dont Sleep First
Warning</button>
<button type="button" name="button">Dont Sleep Second
Warning</button>
<button type="button" name="button">Dont Sleep Third
Warning</button>
<script type="text/javascript" src='demo.js'></script>
</body>
</html>
demo.js:
--------
$('h1').click(function(){
alert('Click any button, you will get greetings message')
})
$('button:first').click(function(){
alert('Hello Dont Sleep')
$(this).css('background','yellow')
})
$('button:nth-of-type(2)').click(function(){
243
alert('Hello Dont Sleep, I will beat you')
$(this).css('background','orange')
})
$('button:last').click(function(){
alert('Hello Stupid, dont sleep, I will kill you')
$(this).css('background','red')
})
2. keypress():
--------------
We can use this method to add key press listener to elements.
eg:
Enter Name: <input type='text'>
X 88
x IS 120
$('input').keypress(function(event){
244
console.log(event)
})
$('input').keypress(function(event){
if(event.which == 88 || event.which == 120){
alert('Hello you are pressing x or X, You are under monitoring!!!')
}
})
3. on():
--------
It is similar to vanilla javascript addEventListener()
245
$('h1').on('mouseover',function(){
$(this).text('BANGALORE CITY')
$(this).css({background:'red',color:'white',fontSize:'25px'})
})
$('h1').on('mouseout',function(){
$(this).text('HYDERABAD CITY')
$(this).css({background:'green',color:'white',fontSize:'50px'})
})
$('button:first').on('click',function(){
alert('Hello Stupid, dont clik me!!!')
})
$('button:last').on('dblclick',function(){
alert('Hello Animal, I will kill you!!!')
})
jQuery Effects:
----------------
246
jQuery provides several inbuilt effects. The main important effects
are:
1. Fading effects
2. Sliding effects
1. Fading effects:
------------------
fadeOut():
hide the matched elements by fading them to transparent.
fadeIn():
Display the matched elements which are fadeout
fadeToggle()
Fadeout--->FadeIn
FadeIn--->FadeOut
$('button').on('click',function(){
$('div').fadeOut(2000);
})
$('button').on('click',function(){
$('div').fadeToggle(3000);
})
247
2. Sliding effects:
-------------------
.slideDown()
Display the matched elements with a sliding motion.
.slideToggle()
Display or hide the matched elements with a sliding motion.
.slideUp()
Hide the matched elements with a sliding motion.
Bootstrap:
xs removed.
248