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
JAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
KimberlyCasem1
 
PPTX
Workshop 2 Slides.pptx
DaniyalSardar
 
PDF
Learn css3
Mostafa Bayomi
 
PPTX
Web Information Systems Html and css
Artificial Intelligence Institute at UofSC
 
PDF
Web Design & Development - Session 2
Shahrzad Peyman
 
PPT
Css class-02
Md Ali Hossain
 
PPTX
Web Development - Lecture 5
Syed Shahzaib Sohail
 
PPT
Cascading Style Sheets
M Vishnuvardhan Reddy
 
PDF
HTML2.pdf
202GCET19
 
PPTX
Casecading Style Sheets for Hyper Text Transfer Protocol.pptx
usmanahmadawan
 
PPT
Css Founder.com | Cssfounder org
Css Founder
 
PDF
Intro to html, css & sass
Sean Wolfe
 
PDF
Html / CSS Presentation
Shawn Calvert
 
PPTX
Lab#1 - Front End Development
Walid Ashraf
 
PPTX
WEB TECHNOLOGY Unit-2.pptx
karthiksmart21
 
PDF
HTML+CSS: how to get started
Dimitris Tsironis
 
PPTX
Ppt of web designing
prab5
 
PPTX
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
brianbyamukama302
 
PPT
Shyam sunder Rajasthan Computer
shyamverma305
 
PPTX
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 
JAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
KimberlyCasem1
 
Workshop 2 Slides.pptx
DaniyalSardar
 
Learn css3
Mostafa Bayomi
 
Web Information Systems Html and css
Artificial Intelligence Institute at UofSC
 
Web Design & Development - Session 2
Shahrzad Peyman
 
Css class-02
Md Ali Hossain
 
Web Development - Lecture 5
Syed Shahzaib Sohail
 
Cascading Style Sheets
M Vishnuvardhan Reddy
 
HTML2.pdf
202GCET19
 
Casecading Style Sheets for Hyper Text Transfer Protocol.pptx
usmanahmadawan
 
Css Founder.com | Cssfounder org
Css Founder
 
Intro to html, css & sass
Sean Wolfe
 
Html / CSS Presentation
Shawn Calvert
 
Lab#1 - Front End Development
Walid Ashraf
 
WEB TECHNOLOGY Unit-2.pptx
karthiksmart21
 
HTML+CSS: how to get started
Dimitris Tsironis
 
Ppt of web designing
prab5
 
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
brianbyamukama302
 
Shyam sunder Rajasthan Computer
shyamverma305
 
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 
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
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PDF
Python Conference Singapore - 19 Jun 2025
ninefyi
 
PDF
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
The Growing Value and Application of FME & GenAI
Safe Software
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PPTX
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PPTX
reInforce 2025 Lightning Talk - Scott Francis.pptx
ScottFrancis51
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PDF
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
PPTX
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
Python Conference Singapore - 19 Jun 2025
ninefyi
 
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
Kubernetes - Architecture & Components.pdf
geethak285
 
The Growing Value and Application of FME & GenAI
Safe Software
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
reInforce 2025 Lightning Talk - Scott Francis.pptx
ScottFrancis51
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 

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.