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

ODP
Easy CSS
DOCX
HTML tags for SEO, SEO,
PPT
Strayer cis-273-week-8-assignment-single-page-website-new
PPT
How To Construct A Search Engine Friendly Website
PPTX
Onpage optimization checklist
PPTX
SEO quick checklist
PPT
Article Marketing - The 8th Internet Marketing Pillar
PPTX
SPS Twin Cities Quick Wins To Jump Start Your SharePoint Implementation
Easy CSS
HTML tags for SEO, SEO,
Strayer cis-273-week-8-assignment-single-page-website-new
How To Construct A Search Engine Friendly Website
Onpage optimization checklist
SEO quick checklist
Article Marketing - The 8th Internet Marketing Pillar
SPS Twin Cities Quick Wins To Jump Start Your SharePoint Implementation

What's hot (6)

PPT
SEO: A Web Design Perspective
PPTX
9 steps to Optimizing Your Website for SEO and Profits
PPTX
Optimizing Your WordPress Site
PDF
Site Optimization Process – Meta Keyword Tag Optimization03 meta keyword opti...
PPTX
Direct Marketing SEO
PPTX
Lesson 4 - Search Engine Optimization
SEO: A Web Design Perspective
9 steps to Optimizing Your Website for SEO and Profits
Optimizing Your WordPress Site
Site Optimization Process – Meta Keyword Tag Optimization03 meta keyword opti...
Direct Marketing SEO
Lesson 4 - Search Engine Optimization
Ad

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

PDF
12- Learn CSS Fundamentals / Mix & group
PDF
9- Learn CSS Fundamentals / Pseudo-classes
PDF
8- Learn CSS Fundamentals / Attribute selectors
PDF
14- Learn CSS Fundamentals / Inheritance
PDF
10- Learn CSS Fundamentals / Pseudo-elements
PDF
CSS in React - The Good, The Bad, and The Ugly
PDF
13- Learn CSS Fundamentals / Specificity
PPTX
Css for Development
PPTX
David Weliver
PDF
Critical Rendering Path
PDF
CSS Foundations, pt 1
PDF
EnterJS 2015 - Continuous Integration for Frontend Code
PDF
Front End Best Practices
PDF
Get Started With Tailwind React and Create Beautiful Apps.pdf
PPTX
Re-Experience SharePoint: Interface Enhancements in SharePoint 2010
PPT
Css Founder.com | Cssfounder Org
PPT
Website designing company | Cssfounder.com
PPT
Advance Css
PPT
Advance Css 1194323118268797 5
PDF
GDI Seattle Intermediate HTML and CSS Class 1
12- Learn CSS Fundamentals / Mix & group
9- Learn CSS Fundamentals / Pseudo-classes
8- Learn CSS Fundamentals / Attribute selectors
14- Learn CSS Fundamentals / Inheritance
10- Learn CSS Fundamentals / Pseudo-elements
CSS in React - The Good, The Bad, and The Ugly
13- Learn CSS Fundamentals / Specificity
Css for Development
David Weliver
Critical Rendering Path
CSS Foundations, pt 1
EnterJS 2015 - Continuous Integration for Frontend Code
Front End Best Practices
Get Started With Tailwind React and Create Beautiful Apps.pdf
Re-Experience SharePoint: Interface Enhancements in SharePoint 2010
Css Founder.com | Cssfounder Org
Website designing company | Cssfounder.com
Advance Css
Advance Css 1194323118268797 5
GDI Seattle Intermediate HTML and CSS Class 1
Ad

More from In a Rocket (10)

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

Recently uploaded (20)

PDF
Paper PDF World Game (s) Great Redesign.pdf
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
artificialintelligenceai1-copy-210604123353.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
Mathew Digital SEO Checklist Guidlines 2025
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPT
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PPTX
innovation process that make everything different.pptx
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
DOC
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
PDF
Introduction to the IoT system, how the IoT system works
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPT
Ethics in Information System - Management Information System
Paper PDF World Game (s) Great Redesign.pdf
Exploring VPS Hosting Trends for SMBs in 2025
Slides PPTX World Game (s) Eco Economic Epochs.pptx
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
An introduction to the IFRS (ISSB) Stndards.pdf
artificialintelligenceai1-copy-210604123353.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Mathew Digital SEO Checklist Guidlines 2025
The New Creative Director: How AI Tools for Social Media Content Creation Are...
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
Slides PDF The World Game (s) Eco Economic Epochs.pdf
innovation process that make everything different.pptx
SAP Ariba Sourcing PPT for learning material
SASE Traffic Flow - ZTNA Connector-1.pdf
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
Introduction to the IoT system, how the IoT system works
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
Unit-1 introduction to cyber security discuss about how to secure a system
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Ethics in Information System - Management Information System

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