SlideShare a Scribd company logo
IN A ROCKET
Learn front-end development at rocket speed
CSS CSS FUNDAMENTALS
Pseudo-class
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES
With this code all a elements that have not yet been visited are shown in green.
A pseudo-class selects an element with a special state specified by a keyword.
a:link {color: green}
Syntax selector:pseudo-class {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
TARGET &
LANG
UI ELEMENT
STATES
DYNAMIC
NEGATIONSTRUCTURAL
PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
PSEUDO-CLASSES PSEUDO-CLASSES
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Dynamic 

pseudo-classes
:link

:visited

:hover

:active

:focus
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / DYNAMIC / LINK STATES
Contact
a:link 

Represents links that have 

not yet been visited.
Contact
a:visited 

Styles for links that have been visited

(exists in the browser's history).
Contact
a:active 

Triggered when the user clicks the link or 

selects it with the keyboard's tab key.
CLICKED
Contact
a:hover 

Generally triggered when the user hovers over 

an element with the cursor (mouse pointer).
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Dynamic 

pseudo-classes
:link

:visited

:hover

:active

:focus
How to remember them?
😍 LOVE
😤 HATE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / DYNAMIC
With this code all not visited links are shown in green.
Selects all links that have not yet been visited.
a:link {color: green}
Syntax selector:link {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / DYNAMIC
<body>
<a href="#">Not visited.</a>
<a href="#">Visited.</a>
<a href="#">Hover.</a>
<a href="#">Active.</a>
<input type="text" name="zip" id="zip">
</body>
a:link { color: blue; }
a:visited { color: purple; }
a:hover { color: green; }
a:active { color: red; }
input:focus { color: orange; }
Web page title
index.html
Not visited.
Pressed
Visited. Hover. Active. Writing here...
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
TARGET &
LANG
UI ELEMENT
STATES
DYNAMIC
NEGATIONSTRUCTURAL
PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
PSEUDO-CLASSES PSEUDO-CLASSES
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / TARGET & LANG
With this code the terms fragment identifier is shown in green.
Selects a fragment identifier that has a location within a resource.
h2:terms {color: green}
Syntax selector:target {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / TARGET & LANG
<body>
<a href="#about">About.</a>
<a href="#terms">Terms.</a>
<h2 id="about">About our company</h2>
<h2 id="terms">Terms of use</h2>
</body>
h2:target { color: green; }
Web page title
index.html
- About.
- Terms.
About our company
Terms of use
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / TARGET & LANG
With this code the paragraphs in English (en) are shown in green.
Selects elements based on the language they are determined to be in.
p:lang(en) {color: green}
Syntax selector:lang(lg) {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / TARGET & LANG
<body>
<p lang="en"><q>To be, or not to be:
that is the question.</q></p>
<p lang="es"><q>En un lugar de la
Mancha, de cuyo nombre no quiero
acordarme...</q></p>
</body>
p:lang(en) > q { quotes: '201C' '201D'; }
p:lang(es) > q { quotes: '«' '»'; }
Web page title
index.html
“To be, or not to be: that is the question.”
«En un lugar de la Mancha, de cuyo nombre no quiero
acordarme...»
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
TARGET &
LANG
UI ELEMENT
STATES
DYNAMIC
NEGATIONSTRUCTURAL
PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
PSEUDO-CLASSES PSEUDO-CLASSES
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / UI ELEMENT STATES
With this code only the enabled inputs are shown in green.
Selects any enabled element (it can be selected, clicked on, typed into, etc.).
input:enabled {color: green}
Syntax selector:enabled {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / UI ELEMENT STATES
With this code only the disabled inputs are shown in green.
Selects any disabled element.
input:disabled {color: green}
Syntax selector:enabled {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / UI ELEMENT STATES
<body>
<form>
<label for="name">Name:</label>
<input type="text" id="name">
<label for="city">City:</label>
<input type="text" id="city" value="NYC"
disabled="disabled">
<input type="button" value="Submit">
</form>
</body>
input:enabled { color: green; }
input:disabled { color: gray; }
Web page title
index.html
Name:
City:
John Doe
NYC
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / UI ELEMENT STATES
With this code only the checked inputs are shown in green.
Selects any radio, checkbox or option that is checked or toggled to an on state.
input:checked {color: green}
Syntax selector:checked {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / UI ELEMENT STATES
<body>
<form>
<input type="radio" name="pay" id="cash">
<label for="cash">Cash</label>
<input type="radio" name="pay" id="card">
<label for="card">Card</label>
<input type="checkbox" name="nwslt" id="nwslt">
<label for="nwslt">Subscribe me!</label>
</form>
</body>
input[type=radio]:checked + label { color:
green; }
input[type=checkbox]:checked + label { color:
blue; }
Web page title
index.html
Cash Card Subscribe me!
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
TARGET &
LANG
UI ELEMENT
STATES
DYNAMIC
NEGATIONSTRUCTURAL
PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
PSEUDO-CLASSES PSEUDO-CLASSES
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root
:empty

:first-child

:last-child

:nth-child()

:only-child

:first-of-type

:last-of-type

:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
Selects an element that is the root of the document (in HTML, this is always the HTML element).
:root {color: green}
Syntax :root {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<h2>Lorem ipsum dolor</h2>
<p>Nostrum similique veniam commodi sed esse earum
voluptatum corrupti at quam voluptates?</p>
<ul>
<li>Esse</li>
<li>Earum</li>
</ul>
</body>
:root { color: green; }
Web page title
index.html
Lorem ipsum dolor
Nostrum similique veniam commodi sed esse earum voluptatum
corrupti at quam voluptates?
• Esse
• Earum
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<h2>Lorem ipsum dolor</h2>
<p>Nostrum similique veniam commodi sed esse
earum voluptatum corrupti at quam voluptates?
</p>
</body>
:root {
--color-primary: blue;
--color-secondary: gray;
}
p {
background: var(--color-secondary);
color: var(--color-primary);
}
Web page title
index.html
Lorem ipsum dolor
Nostrum similique veniam commodi sed esse earum voluptatum
corrupti at quam voluptates?
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty
:first-child

:last-child

:nth-child()

:only-child

:first-of-type

:last-of-type

:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code only the empty divs are shown in gray.
Selects an element that has no children at all.
div:empty {background: gray}
Syntax element:empty {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<article>
<h2>Item 1</h2>
<p>Item description.</p>
</article>
<article><!-- No item here --></article>
</body>
article {
background: green;
width: 100px;
height: 100px;
}
article:empty {
background: gray;
}
Web page title
index.html
Item 1
Item description.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty

:first-child
:last-child

:nth-child()

:only-child

:first-of-type

:last-of-type

:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code only the first li of a list is shown in green.
Selects an element that is first in a list of siblings.
li:first-child {color: green}
Syntax element:first-child {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<ol>
<li>Usain Bolt - Gold</li>
<li>Yohan Blake - Silver</li>
<li>Justin Gatlin - Bronze</li>
</ol>
</body>
li:first-child { color: green; }
Web page title
index.html
1. Usain Bolt - Gold
2. Yohan Blake - Silver
3. Justin Gatlin - Bronze
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty

:first-child

:last-child
:nth-child()

:only-child

:first-of-type

:last-of-type

:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code only the last li of a list is shown in green.
Selects an element that is last in a list of siblings.
li:last-child {color: green}
Syntax element:last-child {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<ol>
<li>Usain Bolt - Gold</li>
<li>Yohan Blake - Silver</li>
<li>Justin Gatlin - Bronze</li>
<li>Miguel Sánchez - Retired ;)</li>
</ol>
</body>
li:last-child { color: green; }
Web page title
index.html
1. Usain Bolt - Gold
2. Yohan Blake - Silver
3. Justin Gatlin - Bronze
4. Miguel Sánchez - Retired ;)
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty

:first-child

:last-child

:nth-child()
:only-child

:first-of-type

:last-of-type

:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code every odd li of a list is shown in green.
Selects an element that has an+b-1 siblings before it in the document tree and has a parent element.
li:nth-child(2n+1) {color: green}
Syntax element:nth-child(an + b) {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
li:nth-child(4) { color: green; }
• Item 1

• Item 2

• Item 3

• Item 4

• Item 5

• Item 6

• Item 7

• Item 8
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
li:nth-child(2n+1) { color: green; }
• Item 1

• Item 2

• Item 3

• Item 4

• Item 5

• Item 6

• Item 7

• Item 8
First term
Difference
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
li:nth-child(2n+2) { color: green; }
• Item 1

• Item 2

• Item 3

• Item 4

• Item 5

• Item 6

• Item 7

• Item 8
First term
Difference
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
li:nth-child(odd) { color: green; }
• Item 1

• Item 2

• Item 3

• Item 4

• Item 5

• Item 6

• Item 7

• Item 8
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
li:nth-child(even) { color: green; }
• Item 1

• Item 2

• Item 3

• Item 4

• Item 5

• Item 6

• Item 7

• Item 8
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
li:nth-child(1n+3) { color: green; }
• Item 1

• Item 2

• Item 3

• Item 4

• Item 5

• Item 6

• Item 7

• Item 8
First term
Difference
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
li:nth-child(3n+3) { color: green; }
• Item 1

• Item 2

• Item 3

• Item 4

• Item 5

• Item 6

• Item 7

• Item 8
First term
Difference
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty

:first-child

:last-child

:nth-child()

:only-child
:first-of-type

:last-of-type

:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code only an li without siblings is shown in green.
Selects an element that has no siblings.
li:only-child {color: green}
Syntax element:only-child {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<h2>Search results: devices</h2>
<ul>
<li>Laptops</li>
<li>Smartphones</li>
</ul>
<h2>Search results: accessories</h2>
<ul>
<li>No results found</li>
</ul>
</body>
li:only-child { color: green; }
Web page title
index.html
Search results: devices
• Laptops
• Smartphones
Search results: accessories
• No results found
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty

:first-child

:last-child

:nth-child()

:only-child

:first-of-type
:last-of-type

:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code only the first p in a group of children paragraphs is shown in green.
Selects an element that is the first sibling of its type.
p:first-of-type {color: green}
Syntax element:first-of-type {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<main>
<h2>Featured product</h2>
<p>Product description.</p>
<h2>Second product</h2>
<p>Product description.</p>
</main>
</body>
p:first-of-type { color: green; }
Web page title
index.html
Featured product
Product description.
Second product
Product description.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty

:first-child

:last-child

:nth-child()

:only-child

:first-of-type

:last-of-type
:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code only the last p in a group of children paragraphs is shown in green.
Selects an element that is the last sibling of its type.
p:last-of-type {color: green}
Syntax element:first-of-type {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<main>
<h2>First product</h2>
<p>Product description.</p>
<h2>Expiring product</h2>
<p>Last units available.</p>
</main>
</body>
p:last-of-type { color: green; }
Web page title
index.html
First product
Product description.
Expiring product
Last units available.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty

:first-child

:last-child

:nth-child()

:only-child

:first-of-type

:last-of-type

:nth-of-type()
:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code only the odd paragraphs in a group of children paragraphs are shown in green.
Selects elements of a given type, based on their position among a group of siblings.
p:nth-of-type(odd) {color: green}
Syntax element:nth-of-type() {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<main>
<h2>Product 1</h2>
<p>Product description.</p>
<h2>Product 2</h2>
<p>Product description.</p>
<h2>Product 3</h2>
<p>Product description.</p>
<h2>Product 4</h2>
<p>Product description.</p>
</main>
</body>
p:nth-of-type(odd) { color: green; }
Web page title
index.html
Product 1
Product description.
Product 2
Product description.
Product 3
Product description.
Product 4
Product description.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Structural 

pseudo-classes
:root

:empty

:first-child

:last-child

:nth-child()

:only-child

:first-of-type

:last-of-type

:nth-of-type()

:only-of-type
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / STRUCTURAL
With this code only the paragraph with no other siblign paragraphs is shown in green.
Selects an element that has no siblings with the same expanded element name.
p:only-of-type {color: green}
Syntax element:only-of-type() {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / STRUCTURAL
<body>
<article>
<h2>Product 1</h2>
<p>Product description.</p>
<p>Description continues here.</p>
</article>
<article>
<h2>Product 2</h2>
<p>Out of stock.</p>
</article>
</body>
p:only-of-type { color: green; }
Web page title
index.html
Product 1
Product description.
Description continues here.
Product 2
Out of stock.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
TARGET &
LANG
UI ELEMENT
STATES
DYNAMIC
NEGATIONSTRUCTURAL
PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
PSEUDO-CLASSES PSEUDO-CLASSES
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
PSEUDO-CLASSES / NEGATION
With this code all the elements of a header are shown in green, excluding all h1 headers.
Selects elements that do not match a list of selectors.
header :not(h1) {color: green}
Syntax element:not(X) {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / NEGATION
<body>
<header>
<h1>Company name</h1>
<h1>Tagline</h1>
<nav>Navigation goes here.</nav>
<div>User not logged in.</div>
</header>
</body>
header :not(h1) { color: green; }
Web page title
index.html
Company name
Tagline
Product description.
User not logged in.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
PSEUDO-CLASSES / NEGATION
<body>
<p class="mini">Paragraph goes here.</p>
<p>Paragraph goes here.</p>
<p class="mini">Paragraph goes here.</p>
</body>
.mini { color: black; }
p:not(.mini) { color: green; }
Web page title
index.html
Paragraph goes here.
Paragraph goes here.
Paragraph goes here.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
TARGET &
LANG
UI ELEMENT
STATES
DYNAMIC
NEGATIONSTRUCTURAL
PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
PSEUDO-CLASSES PSEUDO-CLASSES
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
REFERENCE: W3C
SOURCE: Selectors Level 3 by W3C.
Learn front-end development at rocket speed
inarocket.com
by miguelsanchez.com
YOU CAN CONTINUE THIS COURSE FOR FREE ON
+ READY TO USE CODE
+ QUIZZES
+ FREE UPDATES
We respect your time

No more blah blah videos. Just straight to
the point slides with relevant information.
Ready to use code

Real code you can just copy and paste into
your real projects.
Step by step guides

Clear and concise steps to build real use
solutions. No missed points.
Learn front-end development at rocket speed
inarocket.com
IN A ROCKET
Learn front-end development at rocket speed
CSS CSS FUNDAMENTALS
Pseudo-class

More Related Content

What's hot (20)

Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Prarthan P
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
Css pseudo-classes
Css pseudo-classesCss pseudo-classes
Css pseudo-classes
Webtech Learning
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 
HTML and CSS crash course!
HTML and CSS crash course!HTML and CSS crash course!
HTML and CSS crash course!
Ana Cidre
 
CSS Selectors
CSS SelectorsCSS Selectors
CSS Selectors
Rachel Andrew
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
Michael Jhon
 
Css tables
Css tablesCss tables
Css tables
AbhishekMondal42
 
Javascript arrays
Javascript arraysJavascript arrays
Javascript arrays
Hassan Dar
 
CSS For Backend Developers
CSS For Backend DevelopersCSS For Backend Developers
CSS For Backend Developers
10Clouds
 
CSS
CSSCSS
CSS
Vladimir Zhidal
 
Css floats
Css floatsCss floats
Css floats
Webtech Learning
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
Amit Kumar Singh
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
Russ Weakley
 
HTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryHTML/CSS/java Script/Jquery
HTML/CSS/java Script/Jquery
FAKHRUN NISHA
 
Css
CssCss
Css
Hemant Saini
 
CSS
CSSCSS
CSS
seedinteractive
 
Html
HtmlHtml
Html
Nisa Soomro
 
Web 2 | CSS - Cascading Style Sheets
Web 2 | CSS - Cascading Style SheetsWeb 2 | CSS - Cascading Style Sheets
Web 2 | CSS - Cascading Style Sheets
Mohammad Imam Hossain
 
Introduction to Javascript By Satyen
Introduction to Javascript By  SatyenIntroduction to Javascript By  Satyen
Introduction to Javascript By Satyen
Satyen Pandya
 

Similar to 9- Learn CSS Fundamentals / Pseudo-classes (20)

12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group
In a Rocket
 
JAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
JAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
JAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
KimberlyCasem1
 
10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements
In a Rocket
 
11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators
In a Rocket
 
13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity
In a Rocket
 
Learn css3
Learn css3Learn css3
Learn css3
Mostafa Bayomi
 
BYOWHC823
BYOWHC823BYOWHC823
BYOWHC823
Thinkful
 
CSS
CSSCSS
CSS
Akila Iroshan
 
Introduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and JqueryIntroduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and Jquery
valuebound
 
15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color
In a Rocket
 
Types of Selectors (HTML)
Types of Selectors (HTML)Types of Selectors (HTML)
Types of Selectors (HTML)
Deanne Alcalde
 
Css class-02
Css class-02Css class-02
Css class-02
Md Ali Hossain
 
Fccwc326
Fccwc326Fccwc326
Fccwc326
Shannon Gallagher
 
Intro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 SlidesIntro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 Slides
Heather Rock
 
04 CSS #burningkeyboards
04 CSS #burningkeyboards04 CSS #burningkeyboards
04 CSS #burningkeyboards
Denis Ristic
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
GuruPada Das
 
cascading style sheet for web developer.pdf
cascading style sheet for web developer.pdfcascading style sheet for web developer.pdf
cascading style sheet for web developer.pdf
nawasyt700
 
Professional Css
Professional CssProfessional Css
Professional Css
Subramanyan Murali
 
HTML+CSS: how to get started
HTML+CSS: how to get startedHTML+CSS: how to get started
HTML+CSS: how to get started
Dimitris Tsironis
 
Lab#1 - Front End Development
Lab#1 - Front End DevelopmentLab#1 - Front End Development
Lab#1 - Front End Development
Walid Ashraf
 
12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group
In a Rocket
 
JAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
JAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
JAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
KimberlyCasem1
 
10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements
In a Rocket
 
11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators
In a Rocket
 
13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity
In a Rocket
 
Introduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and JqueryIntroduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and Jquery
valuebound
 
15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color
In a Rocket
 
Types of Selectors (HTML)
Types of Selectors (HTML)Types of Selectors (HTML)
Types of Selectors (HTML)
Deanne Alcalde
 
Intro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 SlidesIntro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 Slides
Heather Rock
 
04 CSS #burningkeyboards
04 CSS #burningkeyboards04 CSS #burningkeyboards
04 CSS #burningkeyboards
Denis Ristic
 
cascading style sheet for web developer.pdf
cascading style sheet for web developer.pdfcascading style sheet for web developer.pdf
cascading style sheet for web developer.pdf
nawasyt700
 
HTML+CSS: how to get started
HTML+CSS: how to get startedHTML+CSS: how to get started
HTML+CSS: how to get started
Dimitris Tsironis
 
Lab#1 - Front End Development
Lab#1 - Front End DevelopmentLab#1 - Front End Development
Lab#1 - Front End Development
Walid Ashraf
 

More from In a Rocket (11)

3- Learn Flexbox & CSS Grid / Container & items
3- Learn Flexbox & CSS Grid / Container & items3- Learn Flexbox & CSS Grid / Container & items
3- Learn Flexbox & CSS Grid / Container & items
In a Rocket
 
2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context
In a Rocket
 
1- Learn Flexbox & CSS Grid / Environment setup
1- Learn Flexbox & CSS Grid / Environment setup1- Learn Flexbox & CSS Grid / Environment setup
1- Learn Flexbox & CSS Grid / Environment setup
In a Rocket
 
17- Learn CSS Fundamentals / Units
17- Learn CSS Fundamentals / Units17- Learn CSS Fundamentals / Units
17- Learn CSS Fundamentals / Units
In a Rocket
 
16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background
In a Rocket
 
14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance
In a Rocket
 
8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors
In a Rocket
 
2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting
In a Rocket
 
1- Learn HTML Fundamentals / Start in 5 Minutes
1- Learn HTML Fundamentals / Start in 5 Minutes1- Learn HTML Fundamentals / Start in 5 Minutes
1- Learn HTML Fundamentals / Start in 5 Minutes
In a Rocket
 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming Convention
In a Rocket
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
In a Rocket
 
3- Learn Flexbox & CSS Grid / Container & items
3- Learn Flexbox & CSS Grid / Container & items3- Learn Flexbox & CSS Grid / Container & items
3- Learn Flexbox & CSS Grid / Container & items
In a Rocket
 
2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context
In a Rocket
 
1- Learn Flexbox & CSS Grid / Environment setup
1- Learn Flexbox & CSS Grid / Environment setup1- Learn Flexbox & CSS Grid / Environment setup
1- Learn Flexbox & CSS Grid / Environment setup
In a Rocket
 
17- Learn CSS Fundamentals / Units
17- Learn CSS Fundamentals / Units17- Learn CSS Fundamentals / Units
17- Learn CSS Fundamentals / Units
In a Rocket
 
16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background
In a Rocket
 
14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance
In a Rocket
 
8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors
In a Rocket
 
2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting
In a Rocket
 
1- Learn HTML Fundamentals / Start in 5 Minutes
1- Learn HTML Fundamentals / Start in 5 Minutes1- Learn HTML Fundamentals / Start in 5 Minutes
1- Learn HTML Fundamentals / Start in 5 Minutes
In a Rocket
 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming Convention
In a Rocket
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
In a Rocket
 

Recently uploaded (15)

原版西班牙马拉加大学毕业证(UMA毕业证书)如何办理
原版西班牙马拉加大学毕业证(UMA毕业证书)如何办理原版西班牙马拉加大学毕业证(UMA毕业证书)如何办理
原版西班牙马拉加大学毕业证(UMA毕业证书)如何办理
Taqyea
 
Presentation About The Buttons | Selma SALTIK
Presentation About The Buttons | Selma SALTIKPresentation About The Buttons | Selma SALTIK
Presentation About The Buttons | Selma SALTIK
SELMA SALTIK
 
Transport Conjjjjjjjjjjjjjjjjjjjjjjjsulting by Slidesgo.pptx
Transport Conjjjjjjjjjjjjjjjjjjjjjjjsulting by Slidesgo.pptxTransport Conjjjjjjjjjjjjjjjjjjjjjjjsulting by Slidesgo.pptx
Transport Conjjjjjjjjjjjjjjjjjjjjjjjsulting by Slidesgo.pptx
ssuser80a7e81
 
all Practical Project LAST summary note.docx
all Practical Project LAST summary note.docxall Practical Project LAST summary note.docx
all Practical Project LAST summary note.docx
seidjemal94
 
ARTIFICIAL INTELLIGENCE.pptx2565567765676
ARTIFICIAL INTELLIGENCE.pptx2565567765676ARTIFICIAL INTELLIGENCE.pptx2565567765676
ARTIFICIAL INTELLIGENCE.pptx2565567765676
areebaimtiazpmas
 
AI REPLACING HUMANS /FATHER OF AI/BIRTH OF AI
AI REPLACING HUMANS /FATHER OF AI/BIRTH OF AIAI REPLACING HUMANS /FATHER OF AI/BIRTH OF AI
AI REPLACING HUMANS /FATHER OF AI/BIRTH OF AI
skdav34
 
HPC_Course_Presentation_No_Images included.pptx
HPC_Course_Presentation_No_Images included.pptxHPC_Course_Presentation_No_Images included.pptx
HPC_Course_Presentation_No_Images included.pptx
naziaahmadnm
 
Networking concepts from zero to hero that covers the security aspects
Networking concepts from zero to hero that covers the security aspectsNetworking concepts from zero to hero that covers the security aspects
Networking concepts from zero to hero that covers the security aspects
amansinght675
 
basic to advance network security concepts
basic to advance network security conceptsbasic to advance network security concepts
basic to advance network security concepts
amansinght675
 
Essential Tech Stack for Effective Shopify Dropshipping Integration.pdf
Essential Tech Stack for Effective Shopify Dropshipping Integration.pdfEssential Tech Stack for Effective Shopify Dropshipping Integration.pdf
Essential Tech Stack for Effective Shopify Dropshipping Integration.pdf
CartCoders
 
5 Reasons cheap WordPress hosting is costing you more | Reversed Out
5 Reasons cheap WordPress hosting is costing you more | Reversed Out5 Reasons cheap WordPress hosting is costing you more | Reversed Out
5 Reasons cheap WordPress hosting is costing you more | Reversed Out
Reversed Out Creative
 
Cloud VPS Provider in India: The Best Hosting Solution for Your Business
Cloud VPS Provider in India: The Best Hosting Solution for Your BusinessCloud VPS Provider in India: The Best Hosting Solution for Your Business
Cloud VPS Provider in India: The Best Hosting Solution for Your Business
DanaJohnson510230
 
Frontier Unlimited Internet Setup Step-by-Step Guide.pdf
Frontier Unlimited Internet Setup Step-by-Step Guide.pdfFrontier Unlimited Internet Setup Step-by-Step Guide.pdf
Frontier Unlimited Internet Setup Step-by-Step Guide.pdf
Internet Bundle Now
 
All-4 Chapters-Emerging-technology-ppt.pptx
All-4 Chapters-Emerging-technology-ppt.pptxAll-4 Chapters-Emerging-technology-ppt.pptx
All-4 Chapters-Emerging-technology-ppt.pptx
beletetesfaw1
 
Unlocking the Power of SIM Card IoT Connectivity.pdf
Unlocking the Power of SIM Card IoT Connectivity.pdfUnlocking the Power of SIM Card IoT Connectivity.pdf
Unlocking the Power of SIM Card IoT Connectivity.pdf
elite virtual staffing solutions
 
原版西班牙马拉加大学毕业证(UMA毕业证书)如何办理
原版西班牙马拉加大学毕业证(UMA毕业证书)如何办理原版西班牙马拉加大学毕业证(UMA毕业证书)如何办理
原版西班牙马拉加大学毕业证(UMA毕业证书)如何办理
Taqyea
 
Presentation About The Buttons | Selma SALTIK
Presentation About The Buttons | Selma SALTIKPresentation About The Buttons | Selma SALTIK
Presentation About The Buttons | Selma SALTIK
SELMA SALTIK
 
Transport Conjjjjjjjjjjjjjjjjjjjjjjjsulting by Slidesgo.pptx
Transport Conjjjjjjjjjjjjjjjjjjjjjjjsulting by Slidesgo.pptxTransport Conjjjjjjjjjjjjjjjjjjjjjjjsulting by Slidesgo.pptx
Transport Conjjjjjjjjjjjjjjjjjjjjjjjsulting by Slidesgo.pptx
ssuser80a7e81
 
all Practical Project LAST summary note.docx
all Practical Project LAST summary note.docxall Practical Project LAST summary note.docx
all Practical Project LAST summary note.docx
seidjemal94
 
ARTIFICIAL INTELLIGENCE.pptx2565567765676
ARTIFICIAL INTELLIGENCE.pptx2565567765676ARTIFICIAL INTELLIGENCE.pptx2565567765676
ARTIFICIAL INTELLIGENCE.pptx2565567765676
areebaimtiazpmas
 
AI REPLACING HUMANS /FATHER OF AI/BIRTH OF AI
AI REPLACING HUMANS /FATHER OF AI/BIRTH OF AIAI REPLACING HUMANS /FATHER OF AI/BIRTH OF AI
AI REPLACING HUMANS /FATHER OF AI/BIRTH OF AI
skdav34
 
HPC_Course_Presentation_No_Images included.pptx
HPC_Course_Presentation_No_Images included.pptxHPC_Course_Presentation_No_Images included.pptx
HPC_Course_Presentation_No_Images included.pptx
naziaahmadnm
 
Networking concepts from zero to hero that covers the security aspects
Networking concepts from zero to hero that covers the security aspectsNetworking concepts from zero to hero that covers the security aspects
Networking concepts from zero to hero that covers the security aspects
amansinght675
 
basic to advance network security concepts
basic to advance network security conceptsbasic to advance network security concepts
basic to advance network security concepts
amansinght675
 
Essential Tech Stack for Effective Shopify Dropshipping Integration.pdf
Essential Tech Stack for Effective Shopify Dropshipping Integration.pdfEssential Tech Stack for Effective Shopify Dropshipping Integration.pdf
Essential Tech Stack for Effective Shopify Dropshipping Integration.pdf
CartCoders
 
5 Reasons cheap WordPress hosting is costing you more | Reversed Out
5 Reasons cheap WordPress hosting is costing you more | Reversed Out5 Reasons cheap WordPress hosting is costing you more | Reversed Out
5 Reasons cheap WordPress hosting is costing you more | Reversed Out
Reversed Out Creative
 
Cloud VPS Provider in India: The Best Hosting Solution for Your Business
Cloud VPS Provider in India: The Best Hosting Solution for Your BusinessCloud VPS Provider in India: The Best Hosting Solution for Your Business
Cloud VPS Provider in India: The Best Hosting Solution for Your Business
DanaJohnson510230
 
Frontier Unlimited Internet Setup Step-by-Step Guide.pdf
Frontier Unlimited Internet Setup Step-by-Step Guide.pdfFrontier Unlimited Internet Setup Step-by-Step Guide.pdf
Frontier Unlimited Internet Setup Step-by-Step Guide.pdf
Internet Bundle Now
 
All-4 Chapters-Emerging-technology-ppt.pptx
All-4 Chapters-Emerging-technology-ppt.pptxAll-4 Chapters-Emerging-technology-ppt.pptx
All-4 Chapters-Emerging-technology-ppt.pptx
beletetesfaw1
 

9- Learn CSS Fundamentals / Pseudo-classes

  • 1. IN A ROCKET Learn front-end development at rocket speed CSS CSS FUNDAMENTALS Pseudo-class
  • 2. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES With this code all a elements that have not yet been visited are shown in green. A pseudo-class selects an element with a special state specified by a keyword. a:link {color: green} Syntax selector:pseudo-class {style properties}
  • 3. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com TARGET & LANG UI ELEMENT STATES DYNAMIC NEGATIONSTRUCTURAL PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
  • 4. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Dynamic 
 pseudo-classes :link :visited :hover :active :focus
  • 5. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / DYNAMIC / LINK STATES Contact a:link 
 Represents links that have 
 not yet been visited. Contact a:visited 
 Styles for links that have been visited
 (exists in the browser's history). Contact a:active 
 Triggered when the user clicks the link or 
 selects it with the keyboard's tab key. CLICKED Contact a:hover 
 Generally triggered when the user hovers over 
 an element with the cursor (mouse pointer).
  • 6. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Dynamic 
 pseudo-classes :link :visited :hover :active :focus How to remember them? 😍 LOVE 😤 HATE
  • 7. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / DYNAMIC With this code all not visited links are shown in green. Selects all links that have not yet been visited. a:link {color: green} Syntax selector:link {style properties}
  • 8. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / DYNAMIC <body> <a href="#">Not visited.</a> <a href="#">Visited.</a> <a href="#">Hover.</a> <a href="#">Active.</a> <input type="text" name="zip" id="zip"> </body> a:link { color: blue; } a:visited { color: purple; } a:hover { color: green; } a:active { color: red; } input:focus { color: orange; } Web page title index.html Not visited. Pressed Visited. Hover. Active. Writing here... READY TO USE CODE
  • 9. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com TARGET & LANG UI ELEMENT STATES DYNAMIC NEGATIONSTRUCTURAL PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
  • 10. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / TARGET & LANG With this code the terms fragment identifier is shown in green. Selects a fragment identifier that has a location within a resource. h2:terms {color: green} Syntax selector:target {style properties}
  • 11. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / TARGET & LANG <body> <a href="#about">About.</a> <a href="#terms">Terms.</a> <h2 id="about">About our company</h2> <h2 id="terms">Terms of use</h2> </body> h2:target { color: green; } Web page title index.html - About. - Terms. About our company Terms of use READY TO USE CODE
  • 12. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / TARGET & LANG With this code the paragraphs in English (en) are shown in green. Selects elements based on the language they are determined to be in. p:lang(en) {color: green} Syntax selector:lang(lg) {style properties}
  • 13. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / TARGET & LANG <body> <p lang="en"><q>To be, or not to be: that is the question.</q></p> <p lang="es"><q>En un lugar de la Mancha, de cuyo nombre no quiero acordarme...</q></p> </body> p:lang(en) > q { quotes: '201C' '201D'; } p:lang(es) > q { quotes: '«' '»'; } Web page title index.html “To be, or not to be: that is the question.” «En un lugar de la Mancha, de cuyo nombre no quiero acordarme...» READY TO USE CODE
  • 14. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com TARGET & LANG UI ELEMENT STATES DYNAMIC NEGATIONSTRUCTURAL PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
  • 15. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / UI ELEMENT STATES With this code only the enabled inputs are shown in green. Selects any enabled element (it can be selected, clicked on, typed into, etc.). input:enabled {color: green} Syntax selector:enabled {style properties}
  • 16. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / UI ELEMENT STATES With this code only the disabled inputs are shown in green. Selects any disabled element. input:disabled {color: green} Syntax selector:enabled {style properties}
  • 17. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / UI ELEMENT STATES <body> <form> <label for="name">Name:</label> <input type="text" id="name"> <label for="city">City:</label> <input type="text" id="city" value="NYC" disabled="disabled"> <input type="button" value="Submit"> </form> </body> input:enabled { color: green; } input:disabled { color: gray; } Web page title index.html Name: City: John Doe NYC READY TO USE CODE
  • 18. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / UI ELEMENT STATES With this code only the checked inputs are shown in green. Selects any radio, checkbox or option that is checked or toggled to an on state. input:checked {color: green} Syntax selector:checked {style properties}
  • 19. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / UI ELEMENT STATES <body> <form> <input type="radio" name="pay" id="cash"> <label for="cash">Cash</label> <input type="radio" name="pay" id="card"> <label for="card">Card</label> <input type="checkbox" name="nwslt" id="nwslt"> <label for="nwslt">Subscribe me!</label> </form> </body> input[type=radio]:checked + label { color: green; } input[type=checkbox]:checked + label { color: blue; } Web page title index.html Cash Card Subscribe me! READY TO USE CODE
  • 20. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com TARGET & LANG UI ELEMENT STATES DYNAMIC NEGATIONSTRUCTURAL PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
  • 21. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 22. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL Selects an element that is the root of the document (in HTML, this is always the HTML element). :root {color: green} Syntax :root {style properties}
  • 23. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <h2>Lorem ipsum dolor</h2> <p>Nostrum similique veniam commodi sed esse earum voluptatum corrupti at quam voluptates?</p> <ul> <li>Esse</li> <li>Earum</li> </ul> </body> :root { color: green; } Web page title index.html Lorem ipsum dolor Nostrum similique veniam commodi sed esse earum voluptatum corrupti at quam voluptates? • Esse • Earum READY TO USE CODE
  • 24. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <h2>Lorem ipsum dolor</h2> <p>Nostrum similique veniam commodi sed esse earum voluptatum corrupti at quam voluptates? </p> </body> :root { --color-primary: blue; --color-secondary: gray; } p { background: var(--color-secondary); color: var(--color-primary); } Web page title index.html Lorem ipsum dolor Nostrum similique veniam commodi sed esse earum voluptatum corrupti at quam voluptates? READY TO USE CODE
  • 25. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 26. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code only the empty divs are shown in gray. Selects an element that has no children at all. div:empty {background: gray} Syntax element:empty {style properties}
  • 27. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <article> <h2>Item 1</h2> <p>Item description.</p> </article> <article><!-- No item here --></article> </body> article { background: green; width: 100px; height: 100px; } article:empty { background: gray; } Web page title index.html Item 1 Item description. READY TO USE CODE
  • 28. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 29. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code only the first li of a list is shown in green. Selects an element that is first in a list of siblings. li:first-child {color: green} Syntax element:first-child {style properties}
  • 30. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <ol> <li>Usain Bolt - Gold</li> <li>Yohan Blake - Silver</li> <li>Justin Gatlin - Bronze</li> </ol> </body> li:first-child { color: green; } Web page title index.html 1. Usain Bolt - Gold 2. Yohan Blake - Silver 3. Justin Gatlin - Bronze READY TO USE CODE
  • 31. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 32. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code only the last li of a list is shown in green. Selects an element that is last in a list of siblings. li:last-child {color: green} Syntax element:last-child {style properties}
  • 33. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <ol> <li>Usain Bolt - Gold</li> <li>Yohan Blake - Silver</li> <li>Justin Gatlin - Bronze</li> <li>Miguel Sánchez - Retired ;)</li> </ol> </body> li:last-child { color: green; } Web page title index.html 1. Usain Bolt - Gold 2. Yohan Blake - Silver 3. Justin Gatlin - Bronze 4. Miguel Sánchez - Retired ;) READY TO USE CODE
  • 34. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 35. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code every odd li of a list is shown in green. Selects an element that has an+b-1 siblings before it in the document tree and has a parent element. li:nth-child(2n+1) {color: green} Syntax element:nth-child(an + b) {style properties}
  • 36. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL li:nth-child(4) { color: green; } • Item 1 • Item 2 • Item 3 • Item 4 • Item 5 • Item 6 • Item 7 • Item 8
  • 37. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL li:nth-child(2n+1) { color: green; } • Item 1 • Item 2 • Item 3 • Item 4 • Item 5 • Item 6 • Item 7 • Item 8 First term Difference
  • 38. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL li:nth-child(2n+2) { color: green; } • Item 1 • Item 2 • Item 3 • Item 4 • Item 5 • Item 6 • Item 7 • Item 8 First term Difference
  • 39. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL li:nth-child(odd) { color: green; } • Item 1 • Item 2 • Item 3 • Item 4 • Item 5 • Item 6 • Item 7 • Item 8
  • 40. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL li:nth-child(even) { color: green; } • Item 1 • Item 2 • Item 3 • Item 4 • Item 5 • Item 6 • Item 7 • Item 8
  • 41. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL li:nth-child(1n+3) { color: green; } • Item 1 • Item 2 • Item 3 • Item 4 • Item 5 • Item 6 • Item 7 • Item 8 First term Difference
  • 42. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL li:nth-child(3n+3) { color: green; } • Item 1 • Item 2 • Item 3 • Item 4 • Item 5 • Item 6 • Item 7 • Item 8 First term Difference
  • 43. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 44. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code only an li without siblings is shown in green. Selects an element that has no siblings. li:only-child {color: green} Syntax element:only-child {style properties}
  • 45. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <h2>Search results: devices</h2> <ul> <li>Laptops</li> <li>Smartphones</li> </ul> <h2>Search results: accessories</h2> <ul> <li>No results found</li> </ul> </body> li:only-child { color: green; } Web page title index.html Search results: devices • Laptops • Smartphones Search results: accessories • No results found READY TO USE CODE
  • 46. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 47. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code only the first p in a group of children paragraphs is shown in green. Selects an element that is the first sibling of its type. p:first-of-type {color: green} Syntax element:first-of-type {style properties}
  • 48. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <main> <h2>Featured product</h2> <p>Product description.</p> <h2>Second product</h2> <p>Product description.</p> </main> </body> p:first-of-type { color: green; } Web page title index.html Featured product Product description. Second product Product description. READY TO USE CODE
  • 49. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 50. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code only the last p in a group of children paragraphs is shown in green. Selects an element that is the last sibling of its type. p:last-of-type {color: green} Syntax element:first-of-type {style properties}
  • 51. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <main> <h2>First product</h2> <p>Product description.</p> <h2>Expiring product</h2> <p>Last units available.</p> </main> </body> p:last-of-type { color: green; } Web page title index.html First product Product description. Expiring product Last units available. READY TO USE CODE
  • 52. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 53. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code only the odd paragraphs in a group of children paragraphs are shown in green. Selects elements of a given type, based on their position among a group of siblings. p:nth-of-type(odd) {color: green} Syntax element:nth-of-type() {style properties}
  • 54. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <main> <h2>Product 1</h2> <p>Product description.</p> <h2>Product 2</h2> <p>Product description.</p> <h2>Product 3</h2> <p>Product description.</p> <h2>Product 4</h2> <p>Product description.</p> </main> </body> p:nth-of-type(odd) { color: green; } Web page title index.html Product 1 Product description. Product 2 Product description. Product 3 Product description. Product 4 Product description. READY TO USE CODE
  • 55. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Structural 
 pseudo-classes :root :empty :first-child :last-child :nth-child() :only-child :first-of-type :last-of-type :nth-of-type() :only-of-type
  • 56. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / STRUCTURAL With this code only the paragraph with no other siblign paragraphs is shown in green. Selects an element that has no siblings with the same expanded element name. p:only-of-type {color: green} Syntax element:only-of-type() {style properties}
  • 57. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / STRUCTURAL <body> <article> <h2>Product 1</h2> <p>Product description.</p> <p>Description continues here.</p> </article> <article> <h2>Product 2</h2> <p>Out of stock.</p> </article> </body> p:only-of-type { color: green; } Web page title index.html Product 1 Product description. Description continues here. Product 2 Out of stock. READY TO USE CODE
  • 58. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com TARGET & LANG UI ELEMENT STATES DYNAMIC NEGATIONSTRUCTURAL PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
  • 59. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com PSEUDO-CLASSES / NEGATION With this code all the elements of a header are shown in green, excluding all h1 headers. Selects elements that do not match a list of selectors. header :not(h1) {color: green} Syntax element:not(X) {style properties}
  • 60. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / NEGATION <body> <header> <h1>Company name</h1> <h1>Tagline</h1> <nav>Navigation goes here.</nav> <div>User not logged in.</div> </header> </body> header :not(h1) { color: green; } Web page title index.html Company name Tagline Product description. User not logged in. READY TO USE CODE
  • 61. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser PSEUDO-CLASSES / NEGATION <body> <p class="mini">Paragraph goes here.</p> <p>Paragraph goes here.</p> <p class="mini">Paragraph goes here.</p> </body> .mini { color: black; } p:not(.mini) { color: green; } Web page title index.html Paragraph goes here. Paragraph goes here. Paragraph goes here. READY TO USE CODE
  • 62. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com TARGET & LANG UI ELEMENT STATES DYNAMIC NEGATIONSTRUCTURAL PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES PSEUDO-CLASSES
  • 63. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com REFERENCE: W3C SOURCE: Selectors Level 3 by W3C.
  • 64. Learn front-end development at rocket speed inarocket.com by miguelsanchez.com YOU CAN CONTINUE THIS COURSE FOR FREE ON + READY TO USE CODE + QUIZZES + FREE UPDATES
  • 65. We respect your time
 No more blah blah videos. Just straight to the point slides with relevant information. Ready to use code
 Real code you can just copy and paste into your real projects. Step by step guides
 Clear and concise steps to build real use solutions. No missed points. Learn front-end development at rocket speed inarocket.com
  • 66. IN A ROCKET Learn front-end development at rocket speed CSS CSS FUNDAMENTALS Pseudo-class