SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Downloaden Sie, um offline zu lesen
WDES105
Day 3 -- CSS Compound and Contextual
              Selectors



                           about.me/babon
Compound Selectors
The term "compound selector" is used by
designers and in HTML editors like Adobe
Dreamweaver.

The W3C selectors specification doesn't refer
to compound selectors, instead referring to
"grouping" and "descendant selectors."



                                  about.me/babon
Compound Selectors
"Grouping" -- combines common formatting into
one rule.

When grouping tags with common elements
always use a comma between each tag.




                                about.me/babon
Compound Selectors
"Grouping" Example

h1, h2, h3 { font-family:verdana,sans-serif; }

You can then format elements such as font size
as separate tag selectors.

grouping.html

                                    about.me/babon
Compound Selectors
"Descendant selectors" -- refers to selectors
that are contained within other elements.

When using descendent selectors always use
whitespace between each tag.




                                   about.me/babon
Compound Selectors
"Descendent selectors" Example

.myclass strong { color: #f00; }

descendant.html




                                   about.me/babon
Contextual Selectors
"Contextual selectors" -- an alternate name for
"Descendent selectors"

Apply the rule when second selector appears in
the context of the first (is a descendant of the
first).




                                   about.me/babon
Contextual Selectors
"Child selectors" -- only selects an element if it
is the immediate child of another element.

When using child selectors always use a
greater than sign (>) between each tag.




                                     about.me/babon
Contextual Selectors
"Child selectors" Example

body > h2{color: #00f;}

child.html




                            about.me/babon

Weitere ähnliche Inhalte

Andere mochten auch

Historia de htlm_dayana_y_paula (1)
Historia de htlm_dayana_y_paula (1)Historia de htlm_dayana_y_paula (1)
Historia de htlm_dayana_y_paula (1)paulaandreatovar
 
Deber de computacion
Deber de computacion Deber de computacion
Deber de computacion Diego Velasco
 
Internet das Coisas com Coisas Reais: Java , Things API, Raspberry PI e Toys!
Internet das Coisas com Coisas Reais:  Java , Things API, Raspberry PI e Toys!Internet das Coisas com Coisas Reais:  Java , Things API, Raspberry PI e Toys!
Internet das Coisas com Coisas Reais: Java , Things API, Raspberry PI e Toys!Globalcode
 
Δημιουργικότητα
ΔημιουργικότηταΔημιουργικότητα
Δημιουργικότηταelentzag
 
Социальные сети и блоги. Этика и академический троллинг
Социальные сети и блоги. Этика и академический троллингСоциальные сети и блоги. Этика и академический троллинг
Социальные сети и блоги. Этика и академический троллингГеоргий Мамарин
 
3d assemblage and sculpture presentation
3d assemblage and sculpture presentation3d assemblage and sculpture presentation
3d assemblage and sculpture presentationLoulizerl Infante
 

Andere mochten auch (9)

Sommer 2012
Sommer 2012Sommer 2012
Sommer 2012
 
Historia de htlm_dayana_y_paula (1)
Historia de htlm_dayana_y_paula (1)Historia de htlm_dayana_y_paula (1)
Historia de htlm_dayana_y_paula (1)
 
Sommer 2012
Sommer 2012Sommer 2012
Sommer 2012
 
Deber de computacion
Deber de computacion Deber de computacion
Deber de computacion
 
Internet das Coisas com Coisas Reais: Java , Things API, Raspberry PI e Toys!
Internet das Coisas com Coisas Reais:  Java , Things API, Raspberry PI e Toys!Internet das Coisas com Coisas Reais:  Java , Things API, Raspberry PI e Toys!
Internet das Coisas com Coisas Reais: Java , Things API, Raspberry PI e Toys!
 
Δημιουργικότητα
ΔημιουργικότηταΔημιουργικότητα
Δημιουργικότητα
 
Think aloud
Think aloudThink aloud
Think aloud
 
Социальные сети и блоги. Этика и академический троллинг
Социальные сети и блоги. Этика и академический троллингСоциальные сети и блоги. Этика и академический троллинг
Социальные сети и блоги. Этика и академический троллинг
 
3d assemblage and sculpture presentation
3d assemblage and sculpture presentation3d assemblage and sculpture presentation
3d assemblage and sculpture presentation
 

Mehr von Gene Babon

Job Search | Tropical Depressions | Bowling Alleys
Job Search | Tropical Depressions | Bowling AlleysJob Search | Tropical Depressions | Bowling Alleys
Job Search | Tropical Depressions | Bowling AlleysGene Babon
 
Tech Over Fifty Launch Meeting
Tech Over Fifty Launch MeetingTech Over Fifty Launch Meeting
Tech Over Fifty Launch MeetingGene Babon
 
Anatomy Virtual Self Study Group NEPHP 2018
Anatomy Virtual Self Study Group NEPHP 2018Anatomy Virtual Self Study Group NEPHP 2018
Anatomy Virtual Self Study Group NEPHP 2018Gene Babon
 
Become a Front End Web Developer
Become a Front End Web DeveloperBecome a Front End Web Developer
Become a Front End Web DeveloperGene Babon
 
Navigating a Career in Web Technology
Navigating a Career in Web TechnologyNavigating a Career in Web Technology
Navigating a Career in Web TechnologyGene Babon
 
Getting Things Done
Getting Things DoneGetting Things Done
Getting Things DoneGene Babon
 
jQuery Mobile Hour 4
jQuery Mobile Hour 4jQuery Mobile Hour 4
jQuery Mobile Hour 4Gene Babon
 

Mehr von Gene Babon (20)

Job Search | Tropical Depressions | Bowling Alleys
Job Search | Tropical Depressions | Bowling AlleysJob Search | Tropical Depressions | Bowling Alleys
Job Search | Tropical Depressions | Bowling Alleys
 
Tech Over Fifty Launch Meeting
Tech Over Fifty Launch MeetingTech Over Fifty Launch Meeting
Tech Over Fifty Launch Meeting
 
Anatomy Virtual Self Study Group NEPHP 2018
Anatomy Virtual Self Study Group NEPHP 2018Anatomy Virtual Self Study Group NEPHP 2018
Anatomy Virtual Self Study Group NEPHP 2018
 
Become a Front End Web Developer
Become a Front End Web DeveloperBecome a Front End Web Developer
Become a Front End Web Developer
 
Navigating a Career in Web Technology
Navigating a Career in Web TechnologyNavigating a Career in Web Technology
Navigating a Career in Web Technology
 
Info Session
Info SessionInfo Session
Info Session
 
Info session
Info sessionInfo session
Info session
 
Getting Things Done
Getting Things DoneGetting Things Done
Getting Things Done
 
jQuery Mobile Hour 4
jQuery Mobile Hour 4jQuery Mobile Hour 4
jQuery Mobile Hour 4
 
Lesson 17
Lesson 17Lesson 17
Lesson 17
 
Lesson 18
Lesson 18Lesson 18
Lesson 18
 
Lesson 17
Lesson 17Lesson 17
Lesson 17
 
Lesson 16
Lesson 16Lesson 16
Lesson 16
 
Lesson 15
Lesson 15Lesson 15
Lesson 15
 
Lesson 11
Lesson 11Lesson 11
Lesson 11
 
Lesson 10
Lesson 10Lesson 10
Lesson 10
 
Lesson 09
Lesson 09Lesson 09
Lesson 09
 
Lesson 05
Lesson 05Lesson 05
Lesson 05
 
Lesson 04
Lesson 04Lesson 04
Lesson 04
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
 

Wdes105 day 3