SlideShare a Scribd company logo
HTML5,CSS,Javascript &
Jquery
Valuebound
Introduction:
HTML: Hyper Text Markup Language.
It describes the structure of the web page.
They are represented by tags.
Browsers do not use HTML tags, but use them to render the content of the page.
HTML tags are not case sensitive: <p> means the same as <p>.
HTML5 is the fifth and current version of the HTML standard.
It was published in October 2014 by the World Wide Web Consortium (W3C) to improve the language
with support for the latest multimedia, while keeping it both easily readable by humans and
consistently
understood by computers and devices such as web browsers, parsers, etc.
Some of the commonly used HTML5 Tags:
● <article> - Defines an article in a document.
● <aside> - Defines content aside from the page content.
● <details> - Defines additional details that the user can view or hide.
● <dialog> - Defines a dialog box or window.
● <figcaption> - Defines a caption for a <figure> element.
● <figure> - Defines self-contained content.
● <footer> - Defines a footer for a document or section.
● <header> - Defines a header for a document or section.
● <main> - Defines the main content of a document.
Cascading Style Sheets
(CSS):
CSS is a language that describes the style of an
HTML document.
CSS describes how HTML elements should be
displayed.
WHY CSS ?
HTML was NEVER intended to contain tags for
formatting a web page!
HTML was created to describe the content of a web
page, like:
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
When tags like <font>, and color attributes were
added to the HTML 3.2 specification, it started a
nightmare for web developers. Development of large
websites, where fonts and color information were
added to every single page, became a long and
expensive process.
To solve this problem, the World Wide Web
Consortium (W3C) created CSS.
CSS removed the style formatting from the
HTML page!
CSS gives you the opportunity to create sites that
look very different from page to page, without a lot
of extensive coding.
For example, many sites now do slight color
variations on the different sections of the site. Using
#page IDs, you can change the CSS for each section
and use the same HTML structure for each section.
The only thing that changes is the content and the
CSS.
CSS Tags
General Syntax:
The selector points to the HTML element you want to style.
The declaration block contains one or more declarations separated by
semicolons.
Each declaration includes a CSS property name and a value, separated by a
colon.
A CSS declaration always ends with a semicolon, and declaration blocks are
CSS Selectors
CSS selectors are used to "find" (or select) HTML elements based on their element name, id, class, attribute,
and more.
The element selector selects elements based on the element name.
Whole elements of a particular tag can be selected simply by using their tag name.
For example: To select whole of the content of a paragraph <p>,
We simply write the CSS as:
This results in the paragraph to be center
aligned and
the fonts are in red color through out the page.
p {
Text-alignment:
center;
Color: red;
}
The id Selector
The id selector uses the id attribute of an HTML element to select a specific element.
The id of an element should be unique within a page, so the id selector is used to select one unique element!
To select an element with a specific id, write a hash (#) character, followed by the id of the element.
The style rule below will be applied to the HTML element with id="para1":
Note: An id name cannot start with a number!
CSS:
#para1{
text-align:
center;
color: blue;
font-size: 25px;
}
HTML:
…..
….
<body>
<p id=”para1”> Hello ! Good
Morning </p>
<p> Nice to Meet you </p>
….
….
OUTPUT:
Hello ! Good Morning
Nice to Meet you
The class Selector
The class selector selects elements with a specific class attribute.
To select elements with a specific class, write a period (.) character, followed by the name of the class.
In the example below, all HTML elements with class="center" will be green and center-aligned:
CSS:
.center{
text-align:
center;
color: green;
}
HTML:
…..
….
<body>
<h1 class=”center”>
WELCOME </h1>
<p class=”center”> Nice to
Meet you </p>
..
OUTPUT:
WELCOME
Nice to Meet you
You can also specify that only specific HTML elements should be affected by a class.
In the example below, only <p> elements with class="center" will be center-aligned:
* CSS can also be GROUP - SELECTED
CSS:
p.center{
text-align:
center;
color: green;
}
HTML:
…..
….
<body>
<h1> WELCOME </h1>
<p class=”center”> Nice to
Meet you </p>
..
...
OUTPUT:
WELCOME
Nice to Meet you
CSS:
h1, h2, p {
text-align: center;
color: red;
}
Some of the Pseudo-Elements in CSS are listed
below:
1. :: before Example:
CSS:
p::before{
content: “Read this - “
}
HTML:
….
…
<body>
<h1> HEADING </h1>
<p> ValueBound </p>
<p> HSR Layout </p>
…
….
</body>
….
The ::before selector inserts
something before the content
of each selected element(s).
Use the content property to
specify the content to insert.
OUTPUT:
HEADING
Read this - ValueBound
Read this - HSR Layout
CSS Pseudo-Elements : A CSS pseudo-element is used to style specified parts of an element. Like to style the
first letter, or line, of an element or insert content before, or after, the content of an element.
Some of the commonly used Pseudo-Elements are listed below:
2. ::after
Example: CSS:
p::after{
content: “- Remember
this“
}
HTML:
….
…
<body>
<h1> HEADING </h1>
<p> ValueBound </p>
<p> HSR Layout </p>
…
….
</body>
….
The ::after selector inserts something after the
content of each selected element(s).
Use the content property to specify the content to
insert.
OUTPUT:
HEADING
ValueBound - Remember this
HSR Layout - Remember this
Some of the Pseudo-Classes in CSS are listed
below:
CSS Pseudo-Class : A CSS Pseudo-class is used to define a special state of an element. Like to Style an
element when a user mouses over it or to Style visited and unvisited links differently or to Style an element when it gets focus.
Some of the commonly used Pseudo-Classes are listed below:
Example:
Anchor Pseudo-classes
Links can be displayed in different
ways.
This includes Pseudo-Class tags
like:
● Hover
● Active
● Visited
CSS:
a:visited {
color: green;
}
a:hover {
color: hotpink;
}
a:active {
color: blue;
}
CSS - The :first-child Pseudo-
class
Match the first <p> element :
Match the first <i> element in all <p> elements:
CSS:
p :first-child {
colo
r: blue;
}
HTML:
…
<body>
<p>This is some
text.</p>
<p>This is some
text.</p>
…
</body>
OUTPUT:
This is some
text.
This is some
text.
CSS:
p i : first-child {
colo
r: blue;
}
HTML:
<body>
<p>My fav color is
<i>blue</i></p>
<p>The color of the box is
<i>blue</i></p>
</body>
OUTPUT:
My fav color is blue.
The color of the box is blue
The :first-child pseudo-class matches a specified element that is the first child of another
element.
CSS - The :last-child Pseudo-
class
Example:
The :last-child selector matches every element that is the last child of its parent.
CSS:
p :last-child {
color: red;
}
HTML:
…
<body>
<p>This is text1</p>
<p>This is text2</p>
<p>This is text3</p>
…
</body>
OUTPUT:
This is text1
This is text2
This is text3
CSS - The :nth-child Pseudo-
class
Example:
The :nth-child(n) selector matches every element that is the nth child, regardless of type, of its parent.
n can be a number, a keyword (such as odd or even), or a formula.
CSS:
p:nth-child(2) {
color:
red;
}
HTML:
<body>
<p>The first paragraph.</p>
<p>The second
paragraph.</p>
<p>The third
paragraph.</p>
<p>The fourth
paragraph.</p>
</body>
OUTPUT:
The first paragraph.
The second
paragraph.
The third paragraph.
The fourth paragraph.
Javascript and JQuery
What is jQuery?
JQuery is a lightweight, "write less, do
more", JavaScript library.
The purpose of JQuery is to make it
much easier to use JavaScript on your
website.
JQuery takes a lot of common tasks
that require many lines of JavaScript
code to accomplish, and wraps them
into methods that you can call with a
single line of code.
The jQuery library contains the
following features:
HTML/DOM manipulation
CSS manipulation
HTML event methods
Effects and animations
AJAX
Why jQuery?
There are lots of other
JavaScript frameworks
out there, but jQuery
seems to be the most
popular, and also the
most extendable.
Many of the biggest
companies on the Web
use jQuery, such as:
Google
Microsoft
IBM
Netflix
General Syntax Of Jquery:
$(Selector).action();
Where;
$ = defines /access Query
(selector) = query or find HTML
elements.
action() = actions or events to be
performed
The Document.Ready Event
You might have noticed that all jQuery methods in our examples, are inside a document
ready event:
$(document).ready(function){
// jquery methods go here…
});
This is to prevent any jQuery code from running before the
document is finished loading (is ready).
It is good practice to wait for the document to be fully
loaded and ready before working with it. This also allows
you to have your JavaScript code before the body of your
document, in the head section.
Here are some examples of actions that can fail if
methods are run before the document is fully loaded:
Trying to hide an element that is not created yet
Trying to get the size of an image that is not loaded yet
JQuery Event Methods
What are Events?
All the different visitor's
actions that a web page
can respond to are called
events.
An event represents the
precise moment when
something happens.
Examples:
moving a mouse
over an element
selecting a radio
button
clicking on an
element
jQuery is tailor-
made to respond to
events in an HTML
page.
jQuery Syntax For Event Methods:
To assign a click event to all paragraphs
on a page, you can do this:
$(“p”).click(function(){
//action goes here;
});
jQuery Effects - Animation
The jQuery animate() method is used to create custom animations.
SYNTAX:
$(selector).animate({
params},speed,callback);
The required params parameter defines
the CSS properties to be animated.
The optional speed parameter specifies
the duration of the effect. It can take the
following values: "slow", "fast", or
milliseconds.
The optional callback parameter is a
function to be executed after the
animation completes.
Thank You

More Related Content

What's hot (19)

PPTX
Web Design Assignment 1
beretta21
 
PDF
Html notes
Ismail Mukiibi
 
PPT
Html
Bhumika Ratan
 
ODP
Introduction of Html/css/js
Knoldus Inc.
 
PDF
Introduction to CSS3
Seble Nigussie
 
PPT
A quick guide to Css and java script
AVINASH KUMAR
 
PPTX
Basics of HTML 5 for Beginners
MediaLinkers Kennesaw
 
PDF
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
Troyfawkes
 
PDF
Introduction to HTML
Seble Nigussie
 
PDF
CSS notes
Rajendra Prasad
 
PDF
HTML CSS JS in Nut shell
Ashwin Shiv
 
PDF
HTML & CSS Masterclass
Bernardo Raposo
 
PDF
Introduction to web development - HTML 5
Ayoub Ghozzi
 
PPTX
Html, CSS & Web Designing
Leslie Steele
 
PPTX
HTML Basics by software development company india
iFour Institute - Sustainable Learning
 
PDF
Web development using html 5
Anjan Mahanta
 
PDF
Intro to HTML and CSS - Class 2 Slides
Heather Rock
 
PDF
HTML Lecture Part 1 of 2
Sharon Wasden
 
Web Design Assignment 1
beretta21
 
Html notes
Ismail Mukiibi
 
Introduction of Html/css/js
Knoldus Inc.
 
Introduction to CSS3
Seble Nigussie
 
A quick guide to Css and java script
AVINASH KUMAR
 
Basics of HTML 5 for Beginners
MediaLinkers Kennesaw
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
Troyfawkes
 
Introduction to HTML
Seble Nigussie
 
CSS notes
Rajendra Prasad
 
HTML CSS JS in Nut shell
Ashwin Shiv
 
HTML & CSS Masterclass
Bernardo Raposo
 
Introduction to web development - HTML 5
Ayoub Ghozzi
 
Html, CSS & Web Designing
Leslie Steele
 
HTML Basics by software development company india
iFour Institute - Sustainable Learning
 
Web development using html 5
Anjan Mahanta
 
Intro to HTML and CSS - Class 2 Slides
Heather Rock
 
HTML Lecture Part 1 of 2
Sharon Wasden
 

Similar to Introduction to Html5, css, Javascript and Jquery (20)

PPTX
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
brianbyamukama302
 
PPTX
Workshop 2 Slides.pptx
DaniyalSardar
 
PDF
Presentation on htmlcssjs-130221085257-phpapp02.pdf
MeetRajani2
 
ODP
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
PDF
1. Advanced Web Designing (12th IT) (1).pdf
AAFREEN SHAIKH
 
PPTX
Html
Himanshu Singh
 
PPTX
Html
Himanshu Singh
 
PDF
INTERNSHIP PROJECT PPT RAJ HZL.pdf
DineshKumar522328
 
PPTX
GDG On Campus NBNSCOE Web Workshop Day 1 : HTML & CSS
udaymore742
 
PDF
Web Design Course: CSS lecture 1
Gheyath M. Othman
 
PPTX
Bootcamp - Web Development Session 2
GDSCUniversitasMatan
 
PDF
Html / CSS Presentation
Shawn Calvert
 
PDF
Learn html elements and structure cheatsheet codecademy
nirmalamanjunath
 
PPT
SDP_-_Module_4.ppt
ssuser568d77
 
PPTX
Web Development PPT from Chd University.
akshitp2704
 
PPT
Chapter 4a cascade style sheet css
Tesfaye Yenealem
 
PPTX
AttributesL3.pptx
KrishRaj48
 
PPTX
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
PDF
HSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART I.pdf
AAFREEN SHAIKH
 
PPTX
Html advance
PumoTechnovation
 
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
brianbyamukama302
 
Workshop 2 Slides.pptx
DaniyalSardar
 
Presentation on htmlcssjs-130221085257-phpapp02.pdf
MeetRajani2
 
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
1. Advanced Web Designing (12th IT) (1).pdf
AAFREEN SHAIKH
 
INTERNSHIP PROJECT PPT RAJ HZL.pdf
DineshKumar522328
 
GDG On Campus NBNSCOE Web Workshop Day 1 : HTML & CSS
udaymore742
 
Web Design Course: CSS lecture 1
Gheyath M. Othman
 
Bootcamp - Web Development Session 2
GDSCUniversitasMatan
 
Html / CSS Presentation
Shawn Calvert
 
Learn html elements and structure cheatsheet codecademy
nirmalamanjunath
 
SDP_-_Module_4.ppt
ssuser568d77
 
Web Development PPT from Chd University.
akshitp2704
 
Chapter 4a cascade style sheet css
Tesfaye Yenealem
 
AttributesL3.pptx
KrishRaj48
 
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
HSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART I.pdf
AAFREEN SHAIKH
 
Html advance
PumoTechnovation
 
Ad

More from valuebound (20)

PDF
Scaling Drupal for High Traffic Websites
valuebound
 
PDF
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
valuebound
 
PDF
How to Use DDEV to Streamline Your Drupal Development Process.
valuebound
 
PDF
How to Use AWS to Automate Your IT Operation| Valuebound
valuebound
 
PDF
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
valuebound
 
PDF
Mastering Drupal Theming
valuebound
 
PDF
The Benefits of Cloud Engineering
valuebound
 
PDF
Cloud Computing
valuebound
 
PDF
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
valuebound
 
PDF
Deep dive into ChatGPT
valuebound
 
PDF
Content Creation Solution | Valuebound
valuebound
 
PPTX
Road ahead for Drupal 8 contributed projects
valuebound
 
PPTX
Chatbot with RASA | Valuebound
valuebound
 
PDF
Drupal and Artificial Intelligence for Personalization
valuebound
 
PPTX
Drupal growth in last year | Valuebound
valuebound
 
PPTX
BE NEW TO THE WORLD "BRAVE FROM CHROME"
valuebound
 
PPTX
Event loop in browser
valuebound
 
PPTX
The Basics of MongoDB
valuebound
 
PPTX
React JS: A Secret Preview
valuebound
 
PPTX
Dependency Injection in Drupal 8
valuebound
 
Scaling Drupal for High Traffic Websites
valuebound
 
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
valuebound
 
How to Use DDEV to Streamline Your Drupal Development Process.
valuebound
 
How to Use AWS to Automate Your IT Operation| Valuebound
valuebound
 
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
valuebound
 
Mastering Drupal Theming
valuebound
 
The Benefits of Cloud Engineering
valuebound
 
Cloud Computing
valuebound
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
valuebound
 
Deep dive into ChatGPT
valuebound
 
Content Creation Solution | Valuebound
valuebound
 
Road ahead for Drupal 8 contributed projects
valuebound
 
Chatbot with RASA | Valuebound
valuebound
 
Drupal and Artificial Intelligence for Personalization
valuebound
 
Drupal growth in last year | Valuebound
valuebound
 
BE NEW TO THE WORLD "BRAVE FROM CHROME"
valuebound
 
Event loop in browser
valuebound
 
The Basics of MongoDB
valuebound
 
React JS: A Secret Preview
valuebound
 
Dependency Injection in Drupal 8
valuebound
 
Ad

Recently uploaded (20)

PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
July Patch Tuesday
Ivanti
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Python basic programing language for automation
DanialHabibi2
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 

Introduction to Html5, css, Javascript and Jquery

  • 2. Introduction: HTML: Hyper Text Markup Language. It describes the structure of the web page. They are represented by tags. Browsers do not use HTML tags, but use them to render the content of the page. HTML tags are not case sensitive: <p> means the same as <p>. HTML5 is the fifth and current version of the HTML standard. It was published in October 2014 by the World Wide Web Consortium (W3C) to improve the language with support for the latest multimedia, while keeping it both easily readable by humans and consistently understood by computers and devices such as web browsers, parsers, etc.
  • 3. Some of the commonly used HTML5 Tags: ● <article> - Defines an article in a document. ● <aside> - Defines content aside from the page content. ● <details> - Defines additional details that the user can view or hide. ● <dialog> - Defines a dialog box or window. ● <figcaption> - Defines a caption for a <figure> element. ● <figure> - Defines self-contained content. ● <footer> - Defines a footer for a document or section. ● <header> - Defines a header for a document or section. ● <main> - Defines the main content of a document.
  • 4. Cascading Style Sheets (CSS): CSS is a language that describes the style of an HTML document. CSS describes how HTML elements should be displayed. WHY CSS ? HTML was NEVER intended to contain tags for formatting a web page! HTML was created to describe the content of a web page, like: <h1>This is a heading</h1> <p>This is a paragraph.</p> When tags like <font>, and color attributes were added to the HTML 3.2 specification, it started a nightmare for web developers. Development of large websites, where fonts and color information were added to every single page, became a long and expensive process. To solve this problem, the World Wide Web Consortium (W3C) created CSS. CSS removed the style formatting from the HTML page! CSS gives you the opportunity to create sites that look very different from page to page, without a lot of extensive coding. For example, many sites now do slight color variations on the different sections of the site. Using #page IDs, you can change the CSS for each section and use the same HTML structure for each section. The only thing that changes is the content and the CSS.
  • 5. CSS Tags General Syntax: The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon. A CSS declaration always ends with a semicolon, and declaration blocks are
  • 6. CSS Selectors CSS selectors are used to "find" (or select) HTML elements based on their element name, id, class, attribute, and more. The element selector selects elements based on the element name. Whole elements of a particular tag can be selected simply by using their tag name. For example: To select whole of the content of a paragraph <p>, We simply write the CSS as: This results in the paragraph to be center aligned and the fonts are in red color through out the page. p { Text-alignment: center; Color: red; }
  • 7. The id Selector The id selector uses the id attribute of an HTML element to select a specific element. The id of an element should be unique within a page, so the id selector is used to select one unique element! To select an element with a specific id, write a hash (#) character, followed by the id of the element. The style rule below will be applied to the HTML element with id="para1": Note: An id name cannot start with a number! CSS: #para1{ text-align: center; color: blue; font-size: 25px; } HTML: ….. …. <body> <p id=”para1”> Hello ! Good Morning </p> <p> Nice to Meet you </p> …. …. OUTPUT: Hello ! Good Morning Nice to Meet you
  • 8. The class Selector The class selector selects elements with a specific class attribute. To select elements with a specific class, write a period (.) character, followed by the name of the class. In the example below, all HTML elements with class="center" will be green and center-aligned: CSS: .center{ text-align: center; color: green; } HTML: ….. …. <body> <h1 class=”center”> WELCOME </h1> <p class=”center”> Nice to Meet you </p> .. OUTPUT: WELCOME Nice to Meet you
  • 9. You can also specify that only specific HTML elements should be affected by a class. In the example below, only <p> elements with class="center" will be center-aligned: * CSS can also be GROUP - SELECTED CSS: p.center{ text-align: center; color: green; } HTML: ….. …. <body> <h1> WELCOME </h1> <p class=”center”> Nice to Meet you </p> .. ... OUTPUT: WELCOME Nice to Meet you CSS: h1, h2, p { text-align: center; color: red; }
  • 10. Some of the Pseudo-Elements in CSS are listed below: 1. :: before Example: CSS: p::before{ content: “Read this - “ } HTML: …. … <body> <h1> HEADING </h1> <p> ValueBound </p> <p> HSR Layout </p> … …. </body> …. The ::before selector inserts something before the content of each selected element(s). Use the content property to specify the content to insert. OUTPUT: HEADING Read this - ValueBound Read this - HSR Layout CSS Pseudo-Elements : A CSS pseudo-element is used to style specified parts of an element. Like to style the first letter, or line, of an element or insert content before, or after, the content of an element. Some of the commonly used Pseudo-Elements are listed below:
  • 11. 2. ::after Example: CSS: p::after{ content: “- Remember this“ } HTML: …. … <body> <h1> HEADING </h1> <p> ValueBound </p> <p> HSR Layout </p> … …. </body> …. The ::after selector inserts something after the content of each selected element(s). Use the content property to specify the content to insert. OUTPUT: HEADING ValueBound - Remember this HSR Layout - Remember this
  • 12. Some of the Pseudo-Classes in CSS are listed below: CSS Pseudo-Class : A CSS Pseudo-class is used to define a special state of an element. Like to Style an element when a user mouses over it or to Style visited and unvisited links differently or to Style an element when it gets focus. Some of the commonly used Pseudo-Classes are listed below: Example: Anchor Pseudo-classes Links can be displayed in different ways. This includes Pseudo-Class tags like: ● Hover ● Active ● Visited CSS: a:visited { color: green; } a:hover { color: hotpink; } a:active { color: blue; }
  • 13. CSS - The :first-child Pseudo- class Match the first <p> element : Match the first <i> element in all <p> elements: CSS: p :first-child { colo r: blue; } HTML: … <body> <p>This is some text.</p> <p>This is some text.</p> … </body> OUTPUT: This is some text. This is some text. CSS: p i : first-child { colo r: blue; } HTML: <body> <p>My fav color is <i>blue</i></p> <p>The color of the box is <i>blue</i></p> </body> OUTPUT: My fav color is blue. The color of the box is blue The :first-child pseudo-class matches a specified element that is the first child of another element.
  • 14. CSS - The :last-child Pseudo- class Example: The :last-child selector matches every element that is the last child of its parent. CSS: p :last-child { color: red; } HTML: … <body> <p>This is text1</p> <p>This is text2</p> <p>This is text3</p> … </body> OUTPUT: This is text1 This is text2 This is text3
  • 15. CSS - The :nth-child Pseudo- class Example: The :nth-child(n) selector matches every element that is the nth child, regardless of type, of its parent. n can be a number, a keyword (such as odd or even), or a formula. CSS: p:nth-child(2) { color: red; } HTML: <body> <p>The first paragraph.</p> <p>The second paragraph.</p> <p>The third paragraph.</p> <p>The fourth paragraph.</p> </body> OUTPUT: The first paragraph. The second paragraph. The third paragraph. The fourth paragraph.
  • 16. Javascript and JQuery What is jQuery? JQuery is a lightweight, "write less, do more", JavaScript library. The purpose of JQuery is to make it much easier to use JavaScript on your website. JQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code. The jQuery library contains the following features: HTML/DOM manipulation CSS manipulation HTML event methods Effects and animations AJAX Why jQuery? There are lots of other JavaScript frameworks out there, but jQuery seems to be the most popular, and also the most extendable. Many of the biggest companies on the Web use jQuery, such as: Google Microsoft IBM Netflix General Syntax Of Jquery: $(Selector).action(); Where; $ = defines /access Query (selector) = query or find HTML elements. action() = actions or events to be performed
  • 17. The Document.Ready Event You might have noticed that all jQuery methods in our examples, are inside a document ready event: $(document).ready(function){ // jquery methods go here… }); This is to prevent any jQuery code from running before the document is finished loading (is ready). It is good practice to wait for the document to be fully loaded and ready before working with it. This also allows you to have your JavaScript code before the body of your document, in the head section. Here are some examples of actions that can fail if methods are run before the document is fully loaded: Trying to hide an element that is not created yet Trying to get the size of an image that is not loaded yet
  • 18. JQuery Event Methods What are Events? All the different visitor's actions that a web page can respond to are called events. An event represents the precise moment when something happens. Examples: moving a mouse over an element selecting a radio button clicking on an element jQuery is tailor- made to respond to events in an HTML page. jQuery Syntax For Event Methods: To assign a click event to all paragraphs on a page, you can do this: $(“p”).click(function(){ //action goes here; });
  • 19. jQuery Effects - Animation The jQuery animate() method is used to create custom animations. SYNTAX: $(selector).animate({ params},speed,callback); The required params parameter defines the CSS properties to be animated. The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds. The optional callback parameter is a function to be executed after the animation completes.