SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
inarocket.com
Learn at rocket speed
CSSSELECTORS
Learn front-end development at rocket speed
inarocket.com
by miguelsanchez.com
What is a CSS selector
inarocket.com - CSS / Selectors
WHAT IS A CSS SELECTOR
With this code all paragraphs are shown in blue.
Don’t worry about the declaration. We will learn how to use it later.
A CSS selector allows you to select the content you want to style.
p {color: blue}
Property
Selector Declaration
Value
Basic selectors
inarocket.com - CSS / Selectors
UNIVERSAL SELECTOR
All the elements are shown in blue
A CSS universal selector allows you to select and style any element type.
* {color: blue}
Syntax * {style properties}
inarocket.com - CSS / Selectors
UNIVERSAL SELECTOR
<h1>CSS rocks!</h1>
<p>Hello world.</p>
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
HTML CSS
* {color: blue}
Browser
CSS rocks!
Hello world.
• First item
• Second item
index.html
inarocket.com - CSS / Selectors
ELEMENT SELECTOR
With this code all paragraphs are shown in blue
A CSS element selector allows you to select and style a HTML element.
p {color: blue}
Syntax element {style properties}
inarocket.com - CSS / Selectors
ELEMENT SELECTOR
<p>CSS rocks!</p>
<p>Hello world.</p>
HTML CSS
p {color: blue}
Browser
CSS rocks!
Hello world.
index.html
inarocket.com - CSS / Selectors
ID SELECTOR
Only the element with the “nav” id is shown in blue
A CSS id selector allows you to select and style the element with the specified id.
#nav {color: blue}
Syntax #id_value {style properties}
inarocket.com - CSS / Selectors
ID SELECTOR
<p id=“nav”>CSS rocks!</p>
<p>Hello world.</p>
HTML CSS
#nav {color: blue}
Browser
CSS rocks!
Hello world.
index.html
inarocket.com - CSS / Selectors
CLASS SELECTOR
Only the elements with the “ready” class are shown in blue
A CSS class selector allows you to select and style the elements with the specified class.
.ready {color: blue}
Syntax .classname {style properties}
inarocket.com - CSS / Selectors
CLASS SELECTOR
<div class=“ready”>CSS rocks!</div>
<p>
<strong class=“ready”>Hello world.</strong>
</p>
<p class=“ready”>More content.</p>
HTML CSS
.ready {color: blue}
Browser
CSS rocks!
Hello world.
More content.
index.html
inarocket.com - CSS / Selectors
ELEMENT SPECIFIC SELECTOR
Only the paragraphs with the “ready” class are shown in blue
A CSS element specific selector allows you to select and style only the elements associated with a
specific class/id.
p.ready {color: blue}
Syntax element.classname {style properties}
inarocket.com - CSS / Selectors
ELEMENT SPECIFIC SELECTOR
<p class=“ready”>CSS rocks!</p>
<div class=“ready”>Hello world.</div>
<p>
<strong class=“ready”>More content.</strong>
</p>
HTML CSS
p.ready {color: blue}
Browser
CSS rocks!
Hello world.
More content.
index.html
Relational selectors
inarocket.com - CSS / Selectors
DESCENDANT SELECTOR
All the paragraphs that are descendant of a div element are shown in blue
A CSS descendent selector allows you to select and style all elements that are descendants of a
specified element.
div p {color: blue}
Syntax selector1 selector2 {style properties}
inarocket.com - CSS / Selectors
DESCENDANT SELECTOR
<div>
<p>CSS rocks!</p>
</div>
<p>Hello world.</p>
HTML CSS
div p {color: blue}
Browser
CSS rocks!
Hello world.
index.html
inarocket.com - CSS / Selectors
CHILD SELECTOR
Only the strong elements that are direct descendants of a paragraph are shown in blue
A CSS child selector allows you to select and style only the elements that are direct descendants.
p>strong {color: blue}
Syntax selector1 > selector2 {style properties}
inarocket.com - CSS / Selectors
CHILD SELECTOR
<p><strong>CSS rocks!</strong></p>
<p>
<a href=“#”><strong>Hello world.</strong></a>
</p>
HTML CSS
p>strong {color: blue}
Browser
CSS rocks!
Hello world.
index.html
inarocket.com - CSS / Selectors
ADJACENT SIBLING SELECTOR
Only the paragraphs that immediately follows a h1 are shown in blue.
A CSS adjacent sibling selector allows you to select and style the element that is an immediate
sibling.
h1+p {color: blue}
Syntax former_element + target_element {style properties}
inarocket.com - CSS / Selectors
ADJACENT SIBLING SELECTOR
<p>CSS rocks!</p>
<h1>Hello world.</h1>
<p>More content.</p>
<p>More content.</p>
HTML CSS
h1+p {color: blue}
Browser
CSS rocks!
Hello world.
More content.
More content.
index.html
inarocket.com - CSS / Selectors
GENERAL SIBLING SELECTOR
Only the paragraphs that are siblings of a h1 are shown in blue
A CSS general sibling selector allows you to select and style the elements that are siblings of a given
element.
h1~p {color: blue}
Syntax element ~ element {style properties}
inarocket.com - CSS / Selectors
GENERAL SIBLING SELECTOR
<p>CSS rocks!</p>
<h1>Hello world.</h1>
<p>More content.</p>
<p>More content.</p>
HTML CSS
h1~p {color: blue}
Browser
CSS rocks!
Hello world.
More content.
More content.
index.html
Attribute selectors
inarocket.com - CSS / Selectors
ATTRIBUTE SELECTOR
A CSS attribute selector allows you to select and style an element with a specific attribute or
attribute value.
p[lang] {color: blue}
Syntax element[attr] {style properties}
Only the paragraphs with the lang attribute are shown in blue.
inarocket.com - CSS / Selectors
ATTRIBUTE SELECTOR
<p lang=“en”>CSS rocks!</p>
<p>More content.</p>
<a href=“#” target=“_blank”>Contact</a>
<a href=“#”>About us</a>
HTML CSS
p[lang] {color: blue}
a[target] {color: red}
Browser
CSS rocks!
More content.
Contact
About us
index.html
The a element is shown in blue by default
inarocket.com - CSS / Selectors
ATTRIBUTE SELECTOR
<p lang=“en”>CSS rocks!</p>
<p lang=“fr”>Bonjour!</p>
<a href=“contact.html”>Contact</a>
<a href=“#”>About us</a>
HTML CSS
p[lang=“en”] {color: blue}
a[href=“contact.html”] {color: red}
Browser
CSS rocks!
Bonjour!
Contact
About us
index.html
The a element is shown in blue by default
inarocket.com - CSS / Selectors
ATTRIBUTE SELECTOR
<p lang=“en-gb en-us en-au en-nz”>CSS
rocks!</p>
HTML CSS
p[lang~="en-us"] {color: blue}
Browser
CSS rocks!
index.html
inarocket.com - CSS / Selectors
ATTRIBUTE SELECTOR
<p lang=“en-gb”>CSS rocks!</p>
<p lang=“en-us”>Hello world.</p>
<p lang=“en-au”>More content.</p>
HTML CSS
p[lang="en"] {color: blue}
Browser
CSS rocks!
Hello world.
More content.
index.html
Pseudo-classes
inarocket.com - CSS / Selectors
PSEUDO-CLASS SELECTOR
Links are shown in blue when their state is hover (mouse over them)
A CSS pseudo-class selector allows you to select and style an element with a special state specified
by a keyword.
a:hover {color: blue}
Syntax selector:pseudo-class {style properties}
inarocket.com - CSS / Selectors
PSEUDO-CLASS SELECTOR
<a href=“#”>Contact</a>
HTML CSS
a:hover {color: red}
Browser
Contact
index.html
The mouse is over a link but not clicking it
Structural pseudo-classes
inarocket.com - CSS / Selectors
NTH-CHILD SELECTOR
Only odd paragraphs are shown in blue
A CSS nth-child selector allows you to select and style an element that has an+b-1 siblings before it
in the document tree and has a parent element.
p:nth-child(2n+1) {color: blue}
Syntax element:nth-child(an + b) {style properties}
inarocket.com - CSS / Selectors
NTH-CHILD SELECTOR
<p>Paragraph one</p>
<p>Paragraph two</p>
<p>Paragraph three</p>
<p>Paragraph four</p>
HTML CSS
p:nth-child(2n+1) {color: blue}
Browser
Paragraph one
Paragraph two
Paragraph three
Paragraph four
index.html
inarocket.com - CSS / Selectors
NTH-CHILD SELECTOR
<p>Paragraph one</p>
<p>Paragraph two</p>
<p>Paragraph three</p>
<p>Paragraph four</p>
HTML CSS
p:nth-child(2n) {color: blue}
Browser
Paragraph one
Paragraph two
Paragraph three
Paragraph four
index.html
inarocket.com - CSS / Selectors
NTH-CHILD SELECTOR
<p>Paragraph one</p>
<p>Paragraph two</p>
<p>Paragraph three</p>
<p>Paragraph four</p>
HTML CSS
p:nth-child(3) {color: blue}
Browser
Paragraph one
Paragraph two
Paragraph three
Paragraph four
index.html
inarocket.com - CSS / Selectors
NOTICE
Sorry for the inconvenience.
This presentation is a work in progress.
Are you also interested in learning
BOOTSTRAP 4
POSTCSS?
+
http://inarocket.teachable.com/courses/css-postcss
Please visit:
Learn front-end development at rocket speed
inarocket.com
by miguelsanchez.com
inarocket.com
Learn at rocket speed
CSSSELECTORS

Weitere ähnliche Inhalte

Andere mochten auch

One Long Argument
One Long ArgumentOne Long Argument
One Long ArgumentJohn Lynch
 
A history of science (volume 1)
A history of science (volume 1) A history of science (volume 1)
A history of science (volume 1) Dipoceanov Esrever
 
The Chemical Revolution
The Chemical RevolutionThe Chemical Revolution
The Chemical RevolutionJohn Lynch
 
Introduction to Information Technology ch 02_a
Introduction to Information Technology ch 02_aIntroduction to Information Technology ch 02_a
Introduction to Information Technology ch 02_aShahi Raz Akhtar
 
Dc parent 14 2
Dc parent 14 2Dc parent 14 2
Dc parent 14 2mtaft
 
Tri Merge Sorting Algorithm
Tri Merge Sorting AlgorithmTri Merge Sorting Algorithm
Tri Merge Sorting AlgorithmAshim Sikder
 
Ancient Ideas of Creation & Evolution
Ancient Ideas of Creation & EvolutionAncient Ideas of Creation & Evolution
Ancient Ideas of Creation & EvolutionJohn Lynch
 
National Air And Space Museum Washington DC
National Air And Space Museum Washington DCNational Air And Space Museum Washington DC
National Air And Space Museum Washington DCShivakumar Patil
 
History of Creationism, Parts II & III
History of Creationism, Parts II & IIIHistory of Creationism, Parts II & III
History of Creationism, Parts II & IIIJohn Lynch
 
Introduction to "Origins, Evolution & Creation"
Introduction to "Origins, Evolution & Creation"Introduction to "Origins, Evolution & Creation"
Introduction to "Origins, Evolution & Creation"John Lynch
 

Andere mochten auch (17)

Google
GoogleGoogle
Google
 
Ds 4
Ds 4Ds 4
Ds 4
 
One Long Argument
One Long ArgumentOne Long Argument
One Long Argument
 
A history of science (volume 1)
A history of science (volume 1) A history of science (volume 1)
A history of science (volume 1)
 
simple-sorting algorithms
simple-sorting algorithmssimple-sorting algorithms
simple-sorting algorithms
 
The Chemical Revolution
The Chemical RevolutionThe Chemical Revolution
The Chemical Revolution
 
How We Got Where We Are: 40 Years of Planning...
How We Got Where We Are: 40 Years of Planning...How We Got Where We Are: 40 Years of Planning...
How We Got Where We Are: 40 Years of Planning...
 
Introduction to Information Technology ch 02_a
Introduction to Information Technology ch 02_aIntroduction to Information Technology ch 02_a
Introduction to Information Technology ch 02_a
 
Dc parent 14 2
Dc parent 14 2Dc parent 14 2
Dc parent 14 2
 
Tri Merge Sorting Algorithm
Tri Merge Sorting AlgorithmTri Merge Sorting Algorithm
Tri Merge Sorting Algorithm
 
Ancient Ideas of Creation & Evolution
Ancient Ideas of Creation & EvolutionAncient Ideas of Creation & Evolution
Ancient Ideas of Creation & Evolution
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
sPen Data Management
sPen Data ManagementsPen Data Management
sPen Data Management
 
National Air And Space Museum Washington DC
National Air And Space Museum Washington DCNational Air And Space Museum Washington DC
National Air And Space Museum Washington DC
 
History of Creationism, Parts II & III
History of Creationism, Parts II & IIIHistory of Creationism, Parts II & III
History of Creationism, Parts II & III
 
Introduction to "Origins, Evolution & Creation"
Introduction to "Origins, Evolution & Creation"Introduction to "Origins, Evolution & Creation"
Introduction to "Origins, Evolution & Creation"
 
Chapter one
Chapter oneChapter one
Chapter one
 

Mehr von 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 & itemsIn a Rocket
 
2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / ContextIn 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 setupIn a Rocket
 
17- Learn CSS Fundamentals / Units
17- Learn CSS Fundamentals / Units17- Learn CSS Fundamentals / Units
17- Learn CSS Fundamentals / UnitsIn a Rocket
 
16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / BackgroundIn a Rocket
 
15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / ColorIn a Rocket
 
14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / InheritanceIn a Rocket
 
13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / SpecificityIn a Rocket
 
12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & groupIn a Rocket
 
11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / CombinatorsIn a Rocket
 
10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elementsIn a Rocket
 
9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classesIn a Rocket
 
8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectorsIn a Rocket
 
2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text FormattingIn 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 MinutesIn a Rocket
 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionIn a Rocket
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionIn a Rocket
 

Mehr von In a Rocket (17)

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
 
2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context
 
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
 
17- Learn CSS Fundamentals / Units
17- Learn CSS Fundamentals / Units17- Learn CSS Fundamentals / Units
17- Learn CSS Fundamentals / Units
 
16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background
 
15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color
 
14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance
 
13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity
 
12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group
 
11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators
 
10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements
 
9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes
 
8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors
 
2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting
 
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
 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming Convention
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 

Kürzlich hochgeladen

VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.soniya singh
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceDelhi Call girls
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 

Kürzlich hochgeladen (20)

VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 

Learn CSS3: Selectors

  • 1. inarocket.com Learn at rocket speed CSSSELECTORS
  • 2. Learn front-end development at rocket speed inarocket.com by miguelsanchez.com
  • 3. What is a CSS selector
  • 4. inarocket.com - CSS / Selectors WHAT IS A CSS SELECTOR With this code all paragraphs are shown in blue. Don’t worry about the declaration. We will learn how to use it later. A CSS selector allows you to select the content you want to style. p {color: blue} Property Selector Declaration Value
  • 6. inarocket.com - CSS / Selectors UNIVERSAL SELECTOR All the elements are shown in blue A CSS universal selector allows you to select and style any element type. * {color: blue} Syntax * {style properties}
  • 7. inarocket.com - CSS / Selectors UNIVERSAL SELECTOR <h1>CSS rocks!</h1> <p>Hello world.</p> <ul> <li>First item</li> <li>Second item</li> </ul> HTML CSS * {color: blue} Browser CSS rocks! Hello world. • First item • Second item index.html
  • 8. inarocket.com - CSS / Selectors ELEMENT SELECTOR With this code all paragraphs are shown in blue A CSS element selector allows you to select and style a HTML element. p {color: blue} Syntax element {style properties}
  • 9. inarocket.com - CSS / Selectors ELEMENT SELECTOR <p>CSS rocks!</p> <p>Hello world.</p> HTML CSS p {color: blue} Browser CSS rocks! Hello world. index.html
  • 10. inarocket.com - CSS / Selectors ID SELECTOR Only the element with the “nav” id is shown in blue A CSS id selector allows you to select and style the element with the specified id. #nav {color: blue} Syntax #id_value {style properties}
  • 11. inarocket.com - CSS / Selectors ID SELECTOR <p id=“nav”>CSS rocks!</p> <p>Hello world.</p> HTML CSS #nav {color: blue} Browser CSS rocks! Hello world. index.html
  • 12. inarocket.com - CSS / Selectors CLASS SELECTOR Only the elements with the “ready” class are shown in blue A CSS class selector allows you to select and style the elements with the specified class. .ready {color: blue} Syntax .classname {style properties}
  • 13. inarocket.com - CSS / Selectors CLASS SELECTOR <div class=“ready”>CSS rocks!</div> <p> <strong class=“ready”>Hello world.</strong> </p> <p class=“ready”>More content.</p> HTML CSS .ready {color: blue} Browser CSS rocks! Hello world. More content. index.html
  • 14. inarocket.com - CSS / Selectors ELEMENT SPECIFIC SELECTOR Only the paragraphs with the “ready” class are shown in blue A CSS element specific selector allows you to select and style only the elements associated with a specific class/id. p.ready {color: blue} Syntax element.classname {style properties}
  • 15. inarocket.com - CSS / Selectors ELEMENT SPECIFIC SELECTOR <p class=“ready”>CSS rocks!</p> <div class=“ready”>Hello world.</div> <p> <strong class=“ready”>More content.</strong> </p> HTML CSS p.ready {color: blue} Browser CSS rocks! Hello world. More content. index.html
  • 17. inarocket.com - CSS / Selectors DESCENDANT SELECTOR All the paragraphs that are descendant of a div element are shown in blue A CSS descendent selector allows you to select and style all elements that are descendants of a specified element. div p {color: blue} Syntax selector1 selector2 {style properties}
  • 18. inarocket.com - CSS / Selectors DESCENDANT SELECTOR <div> <p>CSS rocks!</p> </div> <p>Hello world.</p> HTML CSS div p {color: blue} Browser CSS rocks! Hello world. index.html
  • 19. inarocket.com - CSS / Selectors CHILD SELECTOR Only the strong elements that are direct descendants of a paragraph are shown in blue A CSS child selector allows you to select and style only the elements that are direct descendants. p>strong {color: blue} Syntax selector1 > selector2 {style properties}
  • 20. inarocket.com - CSS / Selectors CHILD SELECTOR <p><strong>CSS rocks!</strong></p> <p> <a href=“#”><strong>Hello world.</strong></a> </p> HTML CSS p>strong {color: blue} Browser CSS rocks! Hello world. index.html
  • 21. inarocket.com - CSS / Selectors ADJACENT SIBLING SELECTOR Only the paragraphs that immediately follows a h1 are shown in blue. A CSS adjacent sibling selector allows you to select and style the element that is an immediate sibling. h1+p {color: blue} Syntax former_element + target_element {style properties}
  • 22. inarocket.com - CSS / Selectors ADJACENT SIBLING SELECTOR <p>CSS rocks!</p> <h1>Hello world.</h1> <p>More content.</p> <p>More content.</p> HTML CSS h1+p {color: blue} Browser CSS rocks! Hello world. More content. More content. index.html
  • 23. inarocket.com - CSS / Selectors GENERAL SIBLING SELECTOR Only the paragraphs that are siblings of a h1 are shown in blue A CSS general sibling selector allows you to select and style the elements that are siblings of a given element. h1~p {color: blue} Syntax element ~ element {style properties}
  • 24. inarocket.com - CSS / Selectors GENERAL SIBLING SELECTOR <p>CSS rocks!</p> <h1>Hello world.</h1> <p>More content.</p> <p>More content.</p> HTML CSS h1~p {color: blue} Browser CSS rocks! Hello world. More content. More content. index.html
  • 26. inarocket.com - CSS / Selectors ATTRIBUTE SELECTOR A CSS attribute selector allows you to select and style an element with a specific attribute or attribute value. p[lang] {color: blue} Syntax element[attr] {style properties} Only the paragraphs with the lang attribute are shown in blue.
  • 27. inarocket.com - CSS / Selectors ATTRIBUTE SELECTOR <p lang=“en”>CSS rocks!</p> <p>More content.</p> <a href=“#” target=“_blank”>Contact</a> <a href=“#”>About us</a> HTML CSS p[lang] {color: blue} a[target] {color: red} Browser CSS rocks! More content. Contact About us index.html The a element is shown in blue by default
  • 28. inarocket.com - CSS / Selectors ATTRIBUTE SELECTOR <p lang=“en”>CSS rocks!</p> <p lang=“fr”>Bonjour!</p> <a href=“contact.html”>Contact</a> <a href=“#”>About us</a> HTML CSS p[lang=“en”] {color: blue} a[href=“contact.html”] {color: red} Browser CSS rocks! Bonjour! Contact About us index.html The a element is shown in blue by default
  • 29. inarocket.com - CSS / Selectors ATTRIBUTE SELECTOR <p lang=“en-gb en-us en-au en-nz”>CSS rocks!</p> HTML CSS p[lang~="en-us"] {color: blue} Browser CSS rocks! index.html
  • 30. inarocket.com - CSS / Selectors ATTRIBUTE SELECTOR <p lang=“en-gb”>CSS rocks!</p> <p lang=“en-us”>Hello world.</p> <p lang=“en-au”>More content.</p> HTML CSS p[lang="en"] {color: blue} Browser CSS rocks! Hello world. More content. index.html
  • 32. inarocket.com - CSS / Selectors PSEUDO-CLASS SELECTOR Links are shown in blue when their state is hover (mouse over them) A CSS pseudo-class selector allows you to select and style an element with a special state specified by a keyword. a:hover {color: blue} Syntax selector:pseudo-class {style properties}
  • 33. inarocket.com - CSS / Selectors PSEUDO-CLASS SELECTOR <a href=“#”>Contact</a> HTML CSS a:hover {color: red} Browser Contact index.html The mouse is over a link but not clicking it
  • 35. inarocket.com - CSS / Selectors NTH-CHILD SELECTOR Only odd paragraphs are shown in blue A CSS nth-child selector allows you to select and style an element that has an+b-1 siblings before it in the document tree and has a parent element. p:nth-child(2n+1) {color: blue} Syntax element:nth-child(an + b) {style properties}
  • 36. inarocket.com - CSS / Selectors NTH-CHILD SELECTOR <p>Paragraph one</p> <p>Paragraph two</p> <p>Paragraph three</p> <p>Paragraph four</p> HTML CSS p:nth-child(2n+1) {color: blue} Browser Paragraph one Paragraph two Paragraph three Paragraph four index.html
  • 37. inarocket.com - CSS / Selectors NTH-CHILD SELECTOR <p>Paragraph one</p> <p>Paragraph two</p> <p>Paragraph three</p> <p>Paragraph four</p> HTML CSS p:nth-child(2n) {color: blue} Browser Paragraph one Paragraph two Paragraph three Paragraph four index.html
  • 38. inarocket.com - CSS / Selectors NTH-CHILD SELECTOR <p>Paragraph one</p> <p>Paragraph two</p> <p>Paragraph three</p> <p>Paragraph four</p> HTML CSS p:nth-child(3) {color: blue} Browser Paragraph one Paragraph two Paragraph three Paragraph four index.html
  • 39. inarocket.com - CSS / Selectors NOTICE Sorry for the inconvenience. This presentation is a work in progress.
  • 40. Are you also interested in learning BOOTSTRAP 4 POSTCSS? + http://inarocket.teachable.com/courses/css-postcss Please visit:
  • 41. Learn front-end development at rocket speed inarocket.com by miguelsanchez.com
  • 42. inarocket.com Learn at rocket speed CSSSELECTORS