SlideShare a Scribd company logo
IN A ROCKET
Learn front-end development at rocket speed
CSS CSS FUNDAMENTALS
Combinators
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
CHILD
Combinators
SIBLING
Combinators
DESCENDANT
Combinator
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
DESCENDANT COMBINATOR
Describe an element that is the descendant of another element in the document tree.
header .promo {color: green}
Syntax selectorOutsite selectorInside {style properties}
With this code all elements that have a class promo inside a header element are shown in green.
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
DESCENDANT COMBINATOR
header
.promo
.promo
header .promo
.div
.promo
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
DESCENDANT COMBINATOR
<body>
<header>
<h1 class="promo">Join us</h1>
<div>
<p class="promo">Subscribe to our newsletter!</p>
</div>
</header>
<h1 class="promo">Deals</h1>
<p class="promo">Enjoy a 10% discount.</p>
</body>
.promo { font-style: italic; }
header .promo { color: green; }
Web page title
index.html
Join us
Subscribe to our newsletter!
Deals
Enjoy a 10% discount.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
CHILD
Combinator
SIBLING
Combinators
DESCENDANT
Combinators
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
CHILD COMBINATOR
Only targets immediate child elements.
header > .promo {color: green}
Syntax selectorOutsite > selectorInside {style properties}
With this code only the immediate child elements of header
that have a class promo are shown in green.
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
CHILD COMBINATOR
header
.promo
.promo
header > .promo
.div
.promo
>
.promo
>
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
CHILD COMBINATOR
header > .promo
!
>
>
header
"
.promo
"
.promo div
!
"
.promo
>
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
CHILD COMBINATOR
<body>
<header>
<h1 class="promo">Join us</h1>
<div>
<p class="promo">Subscribe to our
newsletter!</p>
</div>
</header>
</body>
.promo { font-style: italic; }
header > .promo { color: green; }
Web page title
index.html
Join us
Subscribe to our newsletter!
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
CHILD
Combinators
SIBLING
Combinator
DESCENDANT
Combinators
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Sibling 

combinators
General
Adjacent
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
SIBLING COMBINATOR: GENERAL
Select elements based of sibling relationships.
h2 ~ p {color: green}
Syntax selectorA ~ selectorB {style properties}
With this code only the paragraphs that are siblings of h2 are shown in green.
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
SIBLING COMBINATOR: GENERAL
h2
h2 ~ p
p
div
p
p
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
SIBLING COMBINATOR: GENERAL
h2 ~ p
~
"
h2
"
p div
!
"
p
~
"
p
~
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
SIBLING COMBINATOR: GENERAL
<body>
<h2>Join us</h2>
<p>Enjoy weekly deals.</p>
<div>
<p>Subscribe to our newsletter!</p>
</div>
<p>Limited time offer.</p>
</body>
h2 ~ p { color: green; }
Web page title
index.html
Join us
Enjoy weekly deals.

Subscribe to our newsletter!

Limited time offer.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Sibling 

combinators
General

Adjacent
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
SIBLING COMBINATOR: ADJACENT
Select elements that are immediate siblings, not just general.
h2 + p {color: green}
Syntax selectorA + selectorB {style properties}
With this code only the paragraphs that are immediate siblings of h2 are shown in green.
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
SIBLING COMBINATOR: ADJACENT
h2
h2 + p
p
.div
p
p
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
SIBLING COMBINATOR: ADJACENT
h2 + p
+
"
h2
"
p div
!
"
p
"
p
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
SIBLING COMBINATOR: ADJACENT
<body>
<h2>Join us</h2>
<p>Subscribe to our newsletter!</p>
<p>Enjoy weekly deals.</p>
</body>
h2 + p { color: green; }
Web page title
index.html
Join us
Subscribe to our newsletter!

Enjoy weekly deals.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
SIBLING COMBINATOR: ADJACENT
<body>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</body>
li + li { color: green; }
Web page title
index.html
• Item 1

• Item 2

• Item 3

• Item 4

• Item 5
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
CHILD
Combinator
SIBLING
Combinator
DESCENDANT
Combinator
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
AVOID EXTRA SELECTORS
body #container .myclass ul li {....} .someclass li {...}
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
Combinators

More Related Content

What's hot (6)

PPT
SEO: A Web Design Perspective
Vidya Ananthanarayanan
 
PPTX
9 steps to Optimizing Your Website for SEO and Profits
Escape The Matrix
 
PPTX
Optimizing Your WordPress Site
Phil Buckley
 
PDF
Site Optimization Process – Meta Keyword Tag Optimization03 meta keyword opti...
Neeraj Dhiman
 
PPTX
Direct Marketing SEO
AlexisK
 
PPTX
Lesson 4 - Search Engine Optimization
Hanna-Liisa Pender
 
SEO: A Web Design Perspective
Vidya Ananthanarayanan
 
9 steps to Optimizing Your Website for SEO and Profits
Escape The Matrix
 
Optimizing Your WordPress Site
Phil Buckley
 
Site Optimization Process – Meta Keyword Tag Optimization03 meta keyword opti...
Neeraj Dhiman
 
Direct Marketing SEO
AlexisK
 
Lesson 4 - Search Engine Optimization
Hanna-Liisa Pender
 

Similar to 11- Learn CSS Fundamentals / Combinators (20)

PDF
12- Learn CSS Fundamentals / Mix & group
In a Rocket
 
PDF
9- Learn CSS Fundamentals / Pseudo-classes
In a Rocket
 
PDF
8- Learn CSS Fundamentals / Attribute selectors
In a Rocket
 
PDF
14- Learn CSS Fundamentals / Inheritance
In a Rocket
 
PDF
10- Learn CSS Fundamentals / Pseudo-elements
In a Rocket
 
PDF
CSS in React - The Good, The Bad, and The Ugly
Joe Seifi
 
PDF
13- Learn CSS Fundamentals / Specificity
In a Rocket
 
PPTX
Css for Development
tsengsite
 
PPTX
David Weliver
Philip Taylor
 
PDF
Critical Rendering Path
BarbaraFellner1
 
PDF
CSS Foundations, pt 1
Shawn Calvert
 
PDF
EnterJS 2015 - Continuous Integration for Frontend Code
Marcel Birkner
 
PDF
Front End Best Practices
Holger Bartel
 
PDF
Get Started With Tailwind React and Create Beautiful Apps.pdf
RonDosh
 
PPTX
Re-Experience SharePoint: Interface Enhancements in SharePoint 2010
Benjamin Niaulin
 
PPT
Css Founder.com | Cssfounder Org
Css Founder
 
PPT
Website designing company | Cssfounder.com
Css Founder
 
PPT
Advance Css 1194323118268797 5
dharshyamal
 
PPT
Advance Css
vijayta
 
PDF
GDI Seattle Intermediate HTML and CSS Class 1
Heather Rock
 
12- Learn CSS Fundamentals / Mix & group
In a Rocket
 
9- Learn CSS Fundamentals / Pseudo-classes
In a Rocket
 
8- Learn CSS Fundamentals / Attribute selectors
In a Rocket
 
14- Learn CSS Fundamentals / Inheritance
In a Rocket
 
10- Learn CSS Fundamentals / Pseudo-elements
In a Rocket
 
CSS in React - The Good, The Bad, and The Ugly
Joe Seifi
 
13- Learn CSS Fundamentals / Specificity
In a Rocket
 
Css for Development
tsengsite
 
David Weliver
Philip Taylor
 
Critical Rendering Path
BarbaraFellner1
 
CSS Foundations, pt 1
Shawn Calvert
 
EnterJS 2015 - Continuous Integration for Frontend Code
Marcel Birkner
 
Front End Best Practices
Holger Bartel
 
Get Started With Tailwind React and Create Beautiful Apps.pdf
RonDosh
 
Re-Experience SharePoint: Interface Enhancements in SharePoint 2010
Benjamin Niaulin
 
Css Founder.com | Cssfounder Org
Css Founder
 
Website designing company | Cssfounder.com
Css Founder
 
Advance Css 1194323118268797 5
dharshyamal
 
Advance Css
vijayta
 
GDI Seattle Intermediate HTML and CSS Class 1
Heather Rock
 
Ad

More from In a Rocket (10)

PDF
3- Learn Flexbox & CSS Grid / Container & items
In a Rocket
 
PDF
2- Learn Flexbox & CSS Grid / Context
In a Rocket
 
PDF
1- Learn Flexbox & CSS Grid / Environment setup
In a Rocket
 
PDF
17- Learn CSS Fundamentals / Units
In a Rocket
 
PDF
16- Learn CSS Fundamentals / Background
In a Rocket
 
PDF
15- Learn CSS Fundamentals / Color
In a Rocket
 
PDF
2- Learn HTML Fundamentals / Text Formatting
In a Rocket
 
PDF
1- Learn HTML Fundamentals / Start in 5 Minutes
In a Rocket
 
PDF
Learn SUIT: CSS Naming Convention
In a Rocket
 
PDF
Learn BEM: CSS Naming Convention
In a Rocket
 
3- Learn Flexbox & CSS Grid / Container & items
In a Rocket
 
2- Learn Flexbox & CSS Grid / Context
In a Rocket
 
1- Learn Flexbox & CSS Grid / Environment setup
In a Rocket
 
17- Learn CSS Fundamentals / Units
In a Rocket
 
16- Learn CSS Fundamentals / Background
In a Rocket
 
15- Learn CSS Fundamentals / Color
In a Rocket
 
2- Learn HTML Fundamentals / Text Formatting
In a Rocket
 
1- Learn HTML Fundamentals / Start in 5 Minutes
In a Rocket
 
Learn SUIT: CSS Naming Convention
In a Rocket
 
Learn BEM: CSS Naming Convention
In a Rocket
 
Ad

Recently uploaded (20)

PDF
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
PPTX
BitRecover OST to PST Converter Software
antoniogosling01
 
PDF
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
PPT
Almos Entirely Correct Mixing with Apps to Voting
gapati2964
 
PDF
Materi tentang From Digital Economy to Fintech.pdf
Abdul Hakim
 
PPTX
The ARUBA Kind of new Proposal Umum .pptx
andiwarneri
 
PDF
B M Mostofa Kamal Al-Azad [Document & Localization Expert]
Mostofa Kamal Al-Azad
 
PPTX
原版一样(ISM毕业证书)德国多特蒙德国际管理学院毕业证多少钱
taqyed
 
PDF
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
PDF
Clive Dickens RedTech Public Copy - Collaborate or Die
Clive Dickens
 
PPTX
Q1 English3 Week5 [email protected]
JenniferCawaling1
 
PDF
Download Google Chrome for Fast and Secure Web Browsing Experience
hgfdsqetuiplmnvcz43
 
PPTX
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
PDF
Google Chrome vs Other Browsers: Why Users Still Prefer It.pdf
hgfdsqetuiplmnvcz43
 
PDF
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
PDF
Transmission Control Protocol (TCP) and Starlink
APNIC
 
PPTX
原版一样(ANU毕业证书)澳洲澳大利亚国立大学毕业证在线购买
Taqyea
 
PPTX
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
PPTX
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
PDF
Slides: Eco Economic Epochs for The World Game (s) pdf
Steven McGee
 
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
BitRecover OST to PST Converter Software
antoniogosling01
 
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
Almos Entirely Correct Mixing with Apps to Voting
gapati2964
 
Materi tentang From Digital Economy to Fintech.pdf
Abdul Hakim
 
The ARUBA Kind of new Proposal Umum .pptx
andiwarneri
 
B M Mostofa Kamal Al-Azad [Document & Localization Expert]
Mostofa Kamal Al-Azad
 
原版一样(ISM毕业证书)德国多特蒙德国际管理学院毕业证多少钱
taqyed
 
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
Clive Dickens RedTech Public Copy - Collaborate or Die
Clive Dickens
 
Download Google Chrome for Fast and Secure Web Browsing Experience
hgfdsqetuiplmnvcz43
 
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
Google Chrome vs Other Browsers: Why Users Still Prefer It.pdf
hgfdsqetuiplmnvcz43
 
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
Transmission Control Protocol (TCP) and Starlink
APNIC
 
原版一样(ANU毕业证书)澳洲澳大利亚国立大学毕业证在线购买
Taqyea
 
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
Slides: Eco Economic Epochs for The World Game (s) pdf
Steven McGee
 

11- Learn CSS Fundamentals / Combinators

  • 1. IN A ROCKET Learn front-end development at rocket speed CSS CSS FUNDAMENTALS Combinators
  • 2. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com CHILD Combinators SIBLING Combinators DESCENDANT Combinator
  • 3. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com DESCENDANT COMBINATOR Describe an element that is the descendant of another element in the document tree. header .promo {color: green} Syntax selectorOutsite selectorInside {style properties} With this code all elements that have a class promo inside a header element are shown in green.
  • 4. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com DESCENDANT COMBINATOR header .promo .promo header .promo .div .promo
  • 5. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser DESCENDANT COMBINATOR <body> <header> <h1 class="promo">Join us</h1> <div> <p class="promo">Subscribe to our newsletter!</p> </div> </header> <h1 class="promo">Deals</h1> <p class="promo">Enjoy a 10% discount.</p> </body> .promo { font-style: italic; } header .promo { color: green; } Web page title index.html Join us Subscribe to our newsletter! Deals Enjoy a 10% discount. READY TO USE CODE
  • 6. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com CHILD Combinator SIBLING Combinators DESCENDANT Combinators
  • 7. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com CHILD COMBINATOR Only targets immediate child elements. header > .promo {color: green} Syntax selectorOutsite > selectorInside {style properties} With this code only the immediate child elements of header that have a class promo are shown in green.
  • 8. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com CHILD COMBINATOR header .promo .promo header > .promo .div .promo > .promo >
  • 9. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com CHILD COMBINATOR header > .promo ! > > header " .promo " .promo div ! " .promo >
  • 10. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser CHILD COMBINATOR <body> <header> <h1 class="promo">Join us</h1> <div> <p class="promo">Subscribe to our newsletter!</p> </div> </header> </body> .promo { font-style: italic; } header > .promo { color: green; } Web page title index.html Join us Subscribe to our newsletter! READY TO USE CODE
  • 11. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com CHILD Combinators SIBLING Combinator DESCENDANT Combinators
  • 12. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Sibling 
 combinators General Adjacent
  • 13. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com SIBLING COMBINATOR: GENERAL Select elements based of sibling relationships. h2 ~ p {color: green} Syntax selectorA ~ selectorB {style properties} With this code only the paragraphs that are siblings of h2 are shown in green.
  • 14. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com SIBLING COMBINATOR: GENERAL h2 h2 ~ p p div p p
  • 15. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com SIBLING COMBINATOR: GENERAL h2 ~ p ~ " h2 " p div ! " p ~ " p ~
  • 16. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser SIBLING COMBINATOR: GENERAL <body> <h2>Join us</h2> <p>Enjoy weekly deals.</p> <div> <p>Subscribe to our newsletter!</p> </div> <p>Limited time offer.</p> </body> h2 ~ p { color: green; } Web page title index.html Join us Enjoy weekly deals. Subscribe to our newsletter! Limited time offer. READY TO USE CODE
  • 17. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Sibling 
 combinators General Adjacent
  • 18. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com SIBLING COMBINATOR: ADJACENT Select elements that are immediate siblings, not just general. h2 + p {color: green} Syntax selectorA + selectorB {style properties} With this code only the paragraphs that are immediate siblings of h2 are shown in green.
  • 19. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com SIBLING COMBINATOR: ADJACENT h2 h2 + p p .div p p
  • 20. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com SIBLING COMBINATOR: ADJACENT h2 + p + " h2 " p div ! " p " p
  • 21. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser SIBLING COMBINATOR: ADJACENT <body> <h2>Join us</h2> <p>Subscribe to our newsletter!</p> <p>Enjoy weekly deals.</p> </body> h2 + p { color: green; } Web page title index.html Join us Subscribe to our newsletter! Enjoy weekly deals. READY TO USE CODE
  • 22. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser SIBLING COMBINATOR: ADJACENT <body> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> <li>Item 5</li> </ul> </body> li + li { color: green; } Web page title index.html • Item 1 • Item 2 • Item 3 • Item 4 • Item 5 READY TO USE CODE
  • 23. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com CHILD Combinator SIBLING Combinator DESCENDANT Combinator
  • 24. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com AVOID EXTRA SELECTORS body #container .myclass ul li {....} .someclass li {...}
  • 25. 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
  • 26. 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
  • 27. IN A ROCKET Learn front-end development at rocket speed CSS CSS FUNDAMENTALS Combinators