SlideShare uma empresa Scribd logo
1 de 11
Baixar para ler offline
WDES105
Day 4 -- CSS Rules of Rule Conflict




                           about.me/babon
Topics
●   Specificity
●   Importance (point system)
●   Cascade
●   Debugging Internet Explorer




                                  about.me/babon
Specificity
Specificity is a mechanism within the CSS
cascade that aids conflict resolution.

"When two or more declarations that apply to
the same element, and set the same property,
have the same importance and origin, the
declaration with the most specific selector will
take precedence."


                                   about.me/babon
Specificity
Example:

● Four style rules that have a selector that
  matches p elements.

● All four rules contain a color property
  declaration.

● Which rule wins?
                                   about.me/babon
Specificity
Answer:

● The most specific selector’s declaration will
  take precedence.

specificity.html




                                   about.me/babon
Specificity
How to measure specificity (additional info):

1. Start at 0.
2. Add 1000 for inline style attribute.
3. Add 100 for each ID.
4. Add 10 for each attribute, class or pseudo-
   class.
5. Add 1 for each element name or pseudo-
   element.
                                   about.me/babon
Importance
An important declaration can be used to
override specificity (additional info).

Add "!important" to the end of a declaration
before the semicolon.

importance.html


                                   about.me/babon
Cascade
The cascade is a set of rules for determining
which style properties get applied to an
element.




                                  about.me/babon
Cascade
Declarations are sorted in the following order
(from lowest to highest priority):

  user agent declarations
  normal declarations in user style sheets
  normal declarations in author style sheets
  important declarations in author style sheets
  important declarations in user style sheets

                                   about.me/babon
Cascade
The declaration with the highest priority is
applied to the element.

See the cascade in effect by using firebug.

importance.html

additional info

                                    about.me/babon
Debugging Internet Explorer
Access Applications > VirtualBox

Access IETester




                                   about.me/babon

Mais conteúdo relacionado

Semelhante a CSS Rules of Rule Conflict Guide

Css specificity inheritance and the cascade things you should know
Css specificity inheritance and the cascade things you should knowCss specificity inheritance and the cascade things you should know
Css specificity inheritance and the cascade things you should knowMoneer kamal
 
Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Salesforce Developers
 
sap variant-configuration
sap variant-configurationsap variant-configuration
sap variant-configurationRafael Guzman
 
1 variant configuration
1 variant configuration1 variant configuration
1 variant configurationHemant Sharma
 
1 variant configuration
1 variant configuration1 variant configuration
1 variant configurationHemant Sharma
 
(An Extended) Beginners Guide to Object Orientation in PHP
(An Extended) Beginners Guide to Object Orientation in PHP(An Extended) Beginners Guide to Object Orientation in PHP
(An Extended) Beginners Guide to Object Orientation in PHPRick Ogden
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.Luigi Viggiano
 
Elements_Creating_Content_Models.pdf
Elements_Creating_Content_Models.pdfElements_Creating_Content_Models.pdf
Elements_Creating_Content_Models.pdfJeff Smith
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utilityAmit Sharma
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utilityAmit Sharma
 
Class Members Access/Visibility Guide (Checklist)
Class Members Access/Visibility Guide (Checklist)Class Members Access/Visibility Guide (Checklist)
Class Members Access/Visibility Guide (Checklist)Jayasree Perilakkalam
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
Flex3 Deep Dive Final
Flex3 Deep Dive FinalFlex3 Deep Dive Final
Flex3 Deep Dive FinalRJ Owen
 
Data Binding in Silverlight
Data Binding in SilverlightData Binding in Silverlight
Data Binding in SilverlightBoulos Dib
 
Zend Framework And Doctrine
Zend Framework And DoctrineZend Framework And Doctrine
Zend Framework And Doctrineisaaczfoster
 

Semelhante a CSS Rules of Rule Conflict Guide (20)

Css specificity inheritance and the cascade things you should know
Css specificity inheritance and the cascade things you should knowCss specificity inheritance and the cascade things you should know
Css specificity inheritance and the cascade things you should know
 
Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1
 
sap variant-configuration
sap variant-configurationsap variant-configuration
sap variant-configuration
 
1 variant configuration
1 variant configuration1 variant configuration
1 variant configuration
 
1 variant configuration
1 variant configuration1 variant configuration
1 variant configuration
 
VB.net
VB.netVB.net
VB.net
 
(An Extended) Beginners Guide to Object Orientation in PHP
(An Extended) Beginners Guide to Object Orientation in PHP(An Extended) Beginners Guide to Object Orientation in PHP
(An Extended) Beginners Guide to Object Orientation in PHP
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.
 
Elements_Creating_Content_Models.pdf
Elements_Creating_Content_Models.pdfElements_Creating_Content_Models.pdf
Elements_Creating_Content_Models.pdf
 
Wdes105 day 3
Wdes105 day 3Wdes105 day 3
Wdes105 day 3
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utility
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utility
 
Class Members Access/Visibility Guide (Checklist)
Class Members Access/Visibility Guide (Checklist)Class Members Access/Visibility Guide (Checklist)
Class Members Access/Visibility Guide (Checklist)
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
Flex3 Deep Dive Final
Flex3 Deep Dive FinalFlex3 Deep Dive Final
Flex3 Deep Dive Final
 
Data Binding in Silverlight
Data Binding in SilverlightData Binding in Silverlight
Data Binding in Silverlight
 
Zend Framework And Doctrine
Zend Framework And DoctrineZend Framework And Doctrine
Zend Framework And Doctrine
 
Recsys 2016
Recsys 2016Recsys 2016
Recsys 2016
 
Bb Tequila Coding Style (Draft)
Bb Tequila Coding Style (Draft)Bb Tequila Coding Style (Draft)
Bb Tequila Coding Style (Draft)
 

Mais de 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
 

Mais de 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
 

CSS Rules of Rule Conflict Guide

  • 1. WDES105 Day 4 -- CSS Rules of Rule Conflict about.me/babon
  • 2. Topics ● Specificity ● Importance (point system) ● Cascade ● Debugging Internet Explorer about.me/babon
  • 3. Specificity Specificity is a mechanism within the CSS cascade that aids conflict resolution. "When two or more declarations that apply to the same element, and set the same property, have the same importance and origin, the declaration with the most specific selector will take precedence." about.me/babon
  • 4. Specificity Example: ● Four style rules that have a selector that matches p elements. ● All four rules contain a color property declaration. ● Which rule wins? about.me/babon
  • 5. Specificity Answer: ● The most specific selector’s declaration will take precedence. specificity.html about.me/babon
  • 6. Specificity How to measure specificity (additional info): 1. Start at 0. 2. Add 1000 for inline style attribute. 3. Add 100 for each ID. 4. Add 10 for each attribute, class or pseudo- class. 5. Add 1 for each element name or pseudo- element. about.me/babon
  • 7. Importance An important declaration can be used to override specificity (additional info). Add "!important" to the end of a declaration before the semicolon. importance.html about.me/babon
  • 8. Cascade The cascade is a set of rules for determining which style properties get applied to an element. about.me/babon
  • 9. Cascade Declarations are sorted in the following order (from lowest to highest priority): user agent declarations normal declarations in user style sheets normal declarations in author style sheets important declarations in author style sheets important declarations in user style sheets about.me/babon
  • 10. Cascade The declaration with the highest priority is applied to the element. See the cascade in effect by using firebug. importance.html additional info about.me/babon
  • 11. Debugging Internet Explorer Access Applications > VirtualBox Access IETester about.me/babon