SlideShare a Scribd company logo
hello.

Friday, 15 October 2010
Rachel Andrew

                              @rachelandrew

                             rachelandrew.co.uk
                             edgeofmyseat.com
                               grabaperch.com


Friday, 15 October 2010
Mastering
                            CSS3
                          Selectors
Friday, 15 October 2010
CSS3 is the next
                           version of CSS




Friday, 15 October 2010
CSS3 is Modular




Friday, 15 October 2010
Some CSS3 modules
                    are more complete
                        than others



Friday, 15 October 2010
W3C Maturity Levels
                 Working Draft
                 Candidate Recommendation
                 Proposed Recommendation
                 W3C Recommendation
                 http://www.w3.org/2005/10/Process-20051014/tr#maturity-levels




Friday, 15 October 2010
CSS3 is supported by
                       browsers

                          Some browsers and some (parts of) modules.




Friday, 15 October 2010
Using CSS3

Friday, 15 October 2010
Selectors module

                             W3C Proposed Recommendation
                           http://www.w3.org/TR/css3-selectors/




Friday, 15 October 2010
Basic Selectors
                 h1 {}

                 p {}

                 .thing {}

                 #uniquething {}

                 .thing p


Friday, 15 October 2010
The problem with
                           CSS2 selectors




Friday, 15 October 2010
Adding classes


                 <h1>My heading</h1>
                 <p class=”first”> ... </p>
                 <p> ... </p>




Friday, 15 October 2010
CSS3 Selectors
                              “Common sense” new selectors
                   target elements more precisely without adding classes




Friday, 15 October 2010
Structural pseudo-
                            class selectors




Friday, 15 October 2010
a:link {}
                 a:visited {}
                 a:hover {}
                 a:active {}




Friday, 15 October 2010
:first-child

                    target an element when it is the first child of a parent
                                         element




Friday, 15 October 2010
:first-child




Friday, 15 October 2010
:first-child

                 div#wrapper p {
                 ! ! font-size: 1.5em;
                 }




Friday, 15 October 2010
:first-child

                 div#wrapper p:first-child {
                 ! ! font-size: 1.5em;
                 }




Friday, 15 October 2010
:first-child




Friday, 15 October 2010
:last-child

                     target an element when it is the last child of a parent
                                          element




Friday, 15 October 2010
:last-child




Friday, 15 October 2010
:last-child

                 ul#navigation li:last-child {
                 ! ! border-bottom: none;
                 }




Friday, 15 October 2010
:last-child




Friday, 15 October 2010
:nth-child

                   select multiple elements according to their position in
                                      the document tree




Friday, 15 October 2010
:nth-child




Friday, 15 October 2010
:nth-child

                 tr:nth-child(odd) td {
                 ! ! background-color: #f0e9c5;
                 }




Friday, 15 October 2010
:nth-child




Friday, 15 October 2010
:nth-child

                 tr:nth-child(3) td {
                 ! ! background-color: #f0e9c5;
                 }




Friday, 15 October 2010
:nth-child




Friday, 15 October 2010
:nth-child

                 tr:nth-child(2n+1) td {
                 ! ! background-color: #f0e9c5;
                 }


                          http://reference.sitepoint.com/css/understandingnthchildexpressions




Friday, 15 October 2010
:nth-of-type

                   select multiple elements according to their position in
                   the document tree BUT only those elements that are
                         the same as the type the rule is applied to.




Friday, 15 October 2010
:nth-of-type

                 p:nth-of-type(odd) {
                 ! ! background-color: #f0e9c5;
                 }




Friday, 15 October 2010
:nth-of-type




Friday, 15 October 2010
:only-child

                  matches an element if it is the only child element of it’s
                                          parent.




Friday, 15 October 2010
:only-child
                 li {
                 ! list-style-type: disc;
                 }
                 !
                 li:only-child {
                 ! list-style-type: none;
                 }




Friday, 15 October 2010
:only-child




Friday, 15 October 2010
:empty

                          matches an element if it is empty




Friday, 15 October 2010
:empty
                 p {
                 ! padding: 0 0 1em 0;
                 ! margin: 0;
                 }
                 !
                 p:empty {
                 ! padding: 0;
                 }



Friday, 15 October 2010
For input elements

                          Structural pseudo-classes for use with forms.




Friday, 15 October 2010
:checked

                          the checked state of a checkbox or radio button




Friday, 15 October 2010
:checked

                 #agreeterms:checked {
                   border:2px solid blue;
                 }




Friday, 15 October 2010
enabled and disabled

                          detecting input element states




Friday, 15 October 2010
:enabled

                 input:enabled {
                   color: #000;
                 }




Friday, 15 October 2010
:disabled

                 input:disabled {
                   color: #999;
                 }




Friday, 15 October 2010
the Negation
                          pseudo-class

                             :not(selector)




Friday, 15 October 2010
:not
                 <p> ... </p>
                 <p class=”box”> ... </p>
                 <p> ... </p>




Friday, 15 October 2010
:not
                 p:not(.box) {
                 ! padding: 0 0 3em 0;
                 ! margin: 0;
                 }
                 !
                 p.box {
                 ! border:1px solid #000;
                 ! margin: 0 0 2em 0;
                 }


Friday, 15 October 2010
:not




Friday, 15 October 2010
Pseudo-elements




Friday, 15 October 2010
:first-letter

                          the first character of the first line of text




Friday, 15 October 2010
:first-letter
                 div#wrapper:first-letter {
                 ! font-size: 200%;
                 ! font-weight: bold;
                 ! color: red;
                 }




Friday, 15 October 2010
:first-letter




Friday, 15 October 2010
:first-line

                          the first formatted line of text




Friday, 15 October 2010
:first-line
                 div#wrapper:first-line {
                 ! font-size: 200%;
                 ! font-weight: bold;
                 ! color: red;
                 }




Friday, 15 October 2010
:first-line




Friday, 15 October 2010
:before

                          Render content before the element when using
                                       generated content




Friday, 15 October 2010
:before

                 <div id=”content”> ... </div>




Friday, 15 October 2010
:before
                 #content:before {
                   content: "Start here:";
                 }




Friday, 15 October 2010
:before




Friday, 15 October 2010
:after

                          Render content after the element when using
                                      generated content




Friday, 15 October 2010
:after
                 #content:after {
                   content: "End here:";
                 }




Friday, 15 October 2010
::selection

                          Content selected in browser by the user




Friday, 15 October 2010
::selection
                 div#wrapper p::selection {!
                   background-color: red;
                 }




Friday, 15 October 2010
::selection




Friday, 15 October 2010
Combinators

                          Combining selectors to target elements




Friday, 15 October 2010
Descendant Selector

                    Select all elements that are descendants of a specified
                                             parent




Friday, 15 October 2010
Descendant Selector

                 div#wrapper p {
                 ! font-size: 1.5em;
                 }




Friday, 15 October 2010
Child Selector

                          Select all elements that are immediate children of a
                                            specified parent




Friday, 15 October 2010
Child Selector
                 <ul>
                  <li>Item 1
                   <ol>
                      <li>Sub list item 1</li>
                      <li>Sub list item 2</li>
                   </ol>
                  </li>
                  <li>Item 2</li>
                 </ul>

Friday, 15 October 2010
Child Selector

                   li {
                   ! color: #000;
                   }
                   !
                   ul > li {
                   ! color: red;
                   }



Friday, 15 October 2010
Child Selector




Friday, 15 October 2010
Adjacent Sibling

                          Select elements that are the adjacent siblings of an
                                               element




Friday, 15 October 2010
Adjacent Sibling

                 div#wrapper h1 + p {
                 ! font-size: 1.5em;
                 }




Friday, 15 October 2010
Adjacent Sibling




Friday, 15 October 2010
General Sibling

                          Select elements that are the siblings of an element




Friday, 15 October 2010
General Sibling

                 div#wrapper h2~p {
                 ! color: red;
                 }




Friday, 15 October 2010
General Sibling




Friday, 15 October 2010
Attribute Selectors

                            Select elements based on attributes




Friday, 15 October 2010
Attribute Selectors

                 form input[type="text"] {

                 }
                 !
                 form input[type="submit"] {

                 }




Friday, 15 October 2010
Attribute Selectors




Friday, 15 October 2010
Attribute Selectors
                 label[for="fContact"] {
                     ! float: none;
                     ! width: auto;
                 }

                 a[href ^="mailto:"] {
                 ! ! padding-right: 20px;
                 ! ! background-image:url(email.png);
                 ! ! background-repeat: no-repeat;
                 ! ! background-position: right center;
                 }




Friday, 15 October 2010
Browser
                          Support
Friday, 15 October 2010
Browser Support




Friday, 15 October 2010
Does it
                          matter?
Friday, 15 October 2010
Friday, 15 October 2010
Friday, 15 October 2010
Yes, it
                          matters.
Friday, 15 October 2010
Vendor-specific
                            extensions

                           Implementing early stage CSS3




Friday, 15 October 2010
border-radius




Friday, 15 October 2010
border-radius
                 .box {
                    -moz-border-radius: 10px;
                    -webkit-border-radius: 10px;
                    border-radius: 10px;
                  }




Friday, 15 October 2010
In defence of vendor-
                   specific extensions




Friday, 15 October 2010
JavaScript

                          Plug the holes in browser support using JavaScript.




Friday, 15 October 2010
jQuery: first-child
                 div#wrapper p:first-child,
                 div#wrapper p.first {
                 ! ! font-size: 1.5em;
                 }




                 <script src="http://code.jquery.com/jquery-latest.js"></
                 script>
                 <script>
                   $(document).ready(function(){
                 ! $("div#wrapper p:first-child").addClass("first");
                   });
                 </script>



Friday, 15 October 2010
jQuery: last-child
                 ul#navigation li:last-child, ul#navigation li.last {
                 ! ! border-bottom: none;
                 }




                 <script src="http://code.jquery.com/jquery-latest.js"></
                 script>
                 <script>
                   $(document).ready(function(){
                 ! $("ul#navigation li:last-child").addClass("last");
                   });
                 </script>



Friday, 15 October 2010
jQuery: nth-child
                 tr:nth-child(odd) td, td.odd {
                 ! background-color: #f0e9c5;
                 }




                 <script src="http://code.jquery.com/jquery-latest.js"></
                 script>
                 <script>
                   $(document).ready(function(){
                 ! $("tr:nth-child(odd) td").addClass("odd");
                   });
                 </script>



Friday, 15 October 2010
Scripts that “fix IE”

                           http://www.keithclark.co.uk/labs/ie-css3/
                                    http://ecsstender.org




Friday, 15 October 2010
Thank you.




Friday, 15 October 2010

More Related Content

Viewers also liked (20)

PDF
HTML5 Semantics
Shay Howe
 
PDF
Smacking Git Around Advanced Git Tricks
railsconf
 
PDF
Quality Development with HTML5
Shay Howe
 
PDF
Git in a nutshell
Pranesh Vittal
 
PDF
Quality Development with CSS3
Shay Howe
 
PDF
CSS: selectors and the box model
Idan Gazit
 
PDF
Yes, Designer, You CAN Be a Product Leader
Shay Howe
 
PDF
An Intro to HTML & CSS
Shay Howe
 
PDF
CSS Selectors
Rachel Andrew
 
PDF
Git in a nutshell
Nelson Tai
 
PDF
Intro To Git
kyleburton
 
KEY
Git and GitHub
James Gray
 
PDF
Fundamental CSS3
Achmad Solichin
 
PDF
Advanced Git
segv
 
PDF
Git Tutorial 教學
Wen-Tien Chang
 
PDF
Getting Git Right
Sven Peters
 
PDF
Intro to CSS3
Denise Jacobs
 
PPTX
Introduction to Git/Github - A beginner's guide
Rohit Arora
 
PDF
Getting Git
Scott Chacon
 
HTML5 Semantics
Shay Howe
 
Smacking Git Around Advanced Git Tricks
railsconf
 
Quality Development with HTML5
Shay Howe
 
Git in a nutshell
Pranesh Vittal
 
Quality Development with CSS3
Shay Howe
 
CSS: selectors and the box model
Idan Gazit
 
Yes, Designer, You CAN Be a Product Leader
Shay Howe
 
An Intro to HTML & CSS
Shay Howe
 
CSS Selectors
Rachel Andrew
 
Git in a nutshell
Nelson Tai
 
Intro To Git
kyleburton
 
Git and GitHub
James Gray
 
Fundamental CSS3
Achmad Solichin
 
Advanced Git
segv
 
Git Tutorial 教學
Wen-Tien Chang
 
Getting Git Right
Sven Peters
 
Intro to CSS3
Denise Jacobs
 
Introduction to Git/Github - A beginner's guide
Rohit Arora
 
Getting Git
Scott Chacon
 

Similar to Mastering CSS3 Selectors (8)

PDF
IE9 для разработчиков
Yuriy Artyukh
 
PDF
Cutting Edge CSS3 @ WebExpo Tour 2010
Zi Bin Cheah
 
PDF
The Limited Red Society
Naresh Jain
 
PDF
Hardcore Extending Rails 3 - From RailsConf '10
Rick Martínez
 
PDF
Poisoning Rubinius: The _why and How
Brian Ford
 
PDF
使用 PandaForm.com 製作及管理網上表格
Daniel Cheng
 
PDF
Object garphs swapping
Mariano Martínez Peck
 
PDF
Snowflake in music
Erik Duval
 
IE9 для разработчиков
Yuriy Artyukh
 
Cutting Edge CSS3 @ WebExpo Tour 2010
Zi Bin Cheah
 
The Limited Red Society
Naresh Jain
 
Hardcore Extending Rails 3 - From RailsConf '10
Rick Martínez
 
Poisoning Rubinius: The _why and How
Brian Ford
 
使用 PandaForm.com 製作及管理網上表格
Daniel Cheng
 
Object garphs swapping
Mariano Martínez Peck
 
Snowflake in music
Erik Duval
 
Ad

More from Rachel Andrew (20)

PDF
All Day Hey! Unlocking The Power of CSS Grid Layout
Rachel Andrew
 
PDF
SmashingConf SF: Unlocking the Power of CSS Grid Layout
Rachel Andrew
 
PDF
Unlocking the Power of CSS Grid Layout
Rachel Andrew
 
PDF
The Creative New World of CSS
Rachel Andrew
 
PDF
Into the Weeds of CSS Layout
Rachel Andrew
 
PDF
Solving Layout Problems with CSS Grid & Friends - DevFest17
Rachel Andrew
 
PDF
Graduating to Grid
Rachel Andrew
 
PDF
View Source London: Solving Layout Problems with CSS Grid & Friends
Rachel Andrew
 
PDF
DevFest Nantes - Start Using CSS Grid Layout today
Rachel Andrew
 
PDF
Start Using CSS Grid Layout Today - RuhrJS
Rachel Andrew
 
PDF
404.ie: Solving Layout Problems with CSS Grid & Friends
Rachel Andrew
 
PDF
Solving Layout Problems with CSS Grid & Friends - WEBU17
Rachel Andrew
 
PDF
Laying out the future with grid & flexbox - Smashing Conf Freiburg
Rachel Andrew
 
PDF
Solving Layout Problems with CSS Grid & Friends - NordicJS
Rachel Andrew
 
PDF
Google Developers Experts Summit 2017 - CSS Layout
Rachel Andrew
 
PDF
Web Summer Camp Keynote
Rachel Andrew
 
PDF
New CSS Layout Meets the Real World
Rachel Andrew
 
PDF
An Event Apart DC - New CSS Layout meets the Real World
Rachel Andrew
 
PDF
Perch, Patterns and Old Browsers
Rachel Andrew
 
PDF
Evergreen websites for Evergreen browsers
Rachel Andrew
 
All Day Hey! Unlocking The Power of CSS Grid Layout
Rachel Andrew
 
SmashingConf SF: Unlocking the Power of CSS Grid Layout
Rachel Andrew
 
Unlocking the Power of CSS Grid Layout
Rachel Andrew
 
The Creative New World of CSS
Rachel Andrew
 
Into the Weeds of CSS Layout
Rachel Andrew
 
Solving Layout Problems with CSS Grid & Friends - DevFest17
Rachel Andrew
 
Graduating to Grid
Rachel Andrew
 
View Source London: Solving Layout Problems with CSS Grid & Friends
Rachel Andrew
 
DevFest Nantes - Start Using CSS Grid Layout today
Rachel Andrew
 
Start Using CSS Grid Layout Today - RuhrJS
Rachel Andrew
 
404.ie: Solving Layout Problems with CSS Grid & Friends
Rachel Andrew
 
Solving Layout Problems with CSS Grid & Friends - WEBU17
Rachel Andrew
 
Laying out the future with grid & flexbox - Smashing Conf Freiburg
Rachel Andrew
 
Solving Layout Problems with CSS Grid & Friends - NordicJS
Rachel Andrew
 
Google Developers Experts Summit 2017 - CSS Layout
Rachel Andrew
 
Web Summer Camp Keynote
Rachel Andrew
 
New CSS Layout Meets the Real World
Rachel Andrew
 
An Event Apart DC - New CSS Layout meets the Real World
Rachel Andrew
 
Perch, Patterns and Old Browsers
Rachel Andrew
 
Evergreen websites for Evergreen browsers
Rachel Andrew
 
Ad

Recently uploaded (20)

PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 

Mastering CSS3 Selectors

  • 2. Rachel Andrew @rachelandrew rachelandrew.co.uk edgeofmyseat.com grabaperch.com Friday, 15 October 2010
  • 3. Mastering CSS3 Selectors Friday, 15 October 2010
  • 4. CSS3 is the next version of CSS Friday, 15 October 2010
  • 5. CSS3 is Modular Friday, 15 October 2010
  • 6. Some CSS3 modules are more complete than others Friday, 15 October 2010
  • 7. W3C Maturity Levels Working Draft Candidate Recommendation Proposed Recommendation W3C Recommendation http://www.w3.org/2005/10/Process-20051014/tr#maturity-levels Friday, 15 October 2010
  • 8. CSS3 is supported by browsers Some browsers and some (parts of) modules. Friday, 15 October 2010
  • 9. Using CSS3 Friday, 15 October 2010
  • 10. Selectors module W3C Proposed Recommendation http://www.w3.org/TR/css3-selectors/ Friday, 15 October 2010
  • 11. Basic Selectors h1 {} p {} .thing {} #uniquething {} .thing p Friday, 15 October 2010
  • 12. The problem with CSS2 selectors Friday, 15 October 2010
  • 13. Adding classes <h1>My heading</h1> <p class=”first”> ... </p> <p> ... </p> Friday, 15 October 2010
  • 14. CSS3 Selectors “Common sense” new selectors target elements more precisely without adding classes Friday, 15 October 2010
  • 15. Structural pseudo- class selectors Friday, 15 October 2010
  • 16. a:link {} a:visited {} a:hover {} a:active {} Friday, 15 October 2010
  • 17. :first-child target an element when it is the first child of a parent element Friday, 15 October 2010
  • 19. :first-child div#wrapper p { ! ! font-size: 1.5em; } Friday, 15 October 2010
  • 20. :first-child div#wrapper p:first-child { ! ! font-size: 1.5em; } Friday, 15 October 2010
  • 22. :last-child target an element when it is the last child of a parent element Friday, 15 October 2010
  • 24. :last-child ul#navigation li:last-child { ! ! border-bottom: none; } Friday, 15 October 2010
  • 26. :nth-child select multiple elements according to their position in the document tree Friday, 15 October 2010
  • 28. :nth-child tr:nth-child(odd) td { ! ! background-color: #f0e9c5; } Friday, 15 October 2010
  • 30. :nth-child tr:nth-child(3) td { ! ! background-color: #f0e9c5; } Friday, 15 October 2010
  • 32. :nth-child tr:nth-child(2n+1) td { ! ! background-color: #f0e9c5; } http://reference.sitepoint.com/css/understandingnthchildexpressions Friday, 15 October 2010
  • 33. :nth-of-type select multiple elements according to their position in the document tree BUT only those elements that are the same as the type the rule is applied to. Friday, 15 October 2010
  • 34. :nth-of-type p:nth-of-type(odd) { ! ! background-color: #f0e9c5; } Friday, 15 October 2010
  • 36. :only-child matches an element if it is the only child element of it’s parent. Friday, 15 October 2010
  • 37. :only-child li { ! list-style-type: disc; } ! li:only-child { ! list-style-type: none; } Friday, 15 October 2010
  • 39. :empty matches an element if it is empty Friday, 15 October 2010
  • 40. :empty p { ! padding: 0 0 1em 0; ! margin: 0; } ! p:empty { ! padding: 0; } Friday, 15 October 2010
  • 41. For input elements Structural pseudo-classes for use with forms. Friday, 15 October 2010
  • 42. :checked the checked state of a checkbox or radio button Friday, 15 October 2010
  • 43. :checked #agreeterms:checked { border:2px solid blue; } Friday, 15 October 2010
  • 44. enabled and disabled detecting input element states Friday, 15 October 2010
  • 45. :enabled input:enabled { color: #000; } Friday, 15 October 2010
  • 46. :disabled input:disabled { color: #999; } Friday, 15 October 2010
  • 47. the Negation pseudo-class :not(selector) Friday, 15 October 2010
  • 48. :not <p> ... </p> <p class=”box”> ... </p> <p> ... </p> Friday, 15 October 2010
  • 49. :not p:not(.box) { ! padding: 0 0 3em 0; ! margin: 0; } ! p.box { ! border:1px solid #000; ! margin: 0 0 2em 0; } Friday, 15 October 2010
  • 52. :first-letter the first character of the first line of text Friday, 15 October 2010
  • 53. :first-letter div#wrapper:first-letter { ! font-size: 200%; ! font-weight: bold; ! color: red; } Friday, 15 October 2010
  • 55. :first-line the first formatted line of text Friday, 15 October 2010
  • 56. :first-line div#wrapper:first-line { ! font-size: 200%; ! font-weight: bold; ! color: red; } Friday, 15 October 2010
  • 58. :before Render content before the element when using generated content Friday, 15 October 2010
  • 59. :before <div id=”content”> ... </div> Friday, 15 October 2010
  • 60. :before #content:before { content: "Start here:"; } Friday, 15 October 2010
  • 62. :after Render content after the element when using generated content Friday, 15 October 2010
  • 63. :after #content:after { content: "End here:"; } Friday, 15 October 2010
  • 64. ::selection Content selected in browser by the user Friday, 15 October 2010
  • 65. ::selection div#wrapper p::selection {! background-color: red; } Friday, 15 October 2010
  • 67. Combinators Combining selectors to target elements Friday, 15 October 2010
  • 68. Descendant Selector Select all elements that are descendants of a specified parent Friday, 15 October 2010
  • 69. Descendant Selector div#wrapper p { ! font-size: 1.5em; } Friday, 15 October 2010
  • 70. Child Selector Select all elements that are immediate children of a specified parent Friday, 15 October 2010
  • 71. Child Selector <ul> <li>Item 1 <ol> <li>Sub list item 1</li> <li>Sub list item 2</li> </ol> </li> <li>Item 2</li> </ul> Friday, 15 October 2010
  • 72. Child Selector li { ! color: #000; } ! ul > li { ! color: red; } Friday, 15 October 2010
  • 74. Adjacent Sibling Select elements that are the adjacent siblings of an element Friday, 15 October 2010
  • 75. Adjacent Sibling div#wrapper h1 + p { ! font-size: 1.5em; } Friday, 15 October 2010
  • 77. General Sibling Select elements that are the siblings of an element Friday, 15 October 2010
  • 78. General Sibling div#wrapper h2~p { ! color: red; } Friday, 15 October 2010
  • 80. Attribute Selectors Select elements based on attributes Friday, 15 October 2010
  • 81. Attribute Selectors form input[type="text"] { } ! form input[type="submit"] { } Friday, 15 October 2010
  • 83. Attribute Selectors label[for="fContact"] { ! float: none; ! width: auto; } a[href ^="mailto:"] { ! ! padding-right: 20px; ! ! background-image:url(email.png); ! ! background-repeat: no-repeat; ! ! background-position: right center; } Friday, 15 October 2010
  • 84. Browser Support Friday, 15 October 2010
  • 86. Does it matter? Friday, 15 October 2010
  • 89. Yes, it matters. Friday, 15 October 2010
  • 90. Vendor-specific extensions Implementing early stage CSS3 Friday, 15 October 2010
  • 92. border-radius .box { -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } Friday, 15 October 2010
  • 93. In defence of vendor- specific extensions Friday, 15 October 2010
  • 94. JavaScript Plug the holes in browser support using JavaScript. Friday, 15 October 2010
  • 95. jQuery: first-child div#wrapper p:first-child, div#wrapper p.first { ! ! font-size: 1.5em; } <script src="http://code.jquery.com/jquery-latest.js"></ script> <script> $(document).ready(function(){ ! $("div#wrapper p:first-child").addClass("first"); }); </script> Friday, 15 October 2010
  • 96. jQuery: last-child ul#navigation li:last-child, ul#navigation li.last { ! ! border-bottom: none; } <script src="http://code.jquery.com/jquery-latest.js"></ script> <script> $(document).ready(function(){ ! $("ul#navigation li:last-child").addClass("last"); }); </script> Friday, 15 October 2010
  • 97. jQuery: nth-child tr:nth-child(odd) td, td.odd { ! background-color: #f0e9c5; } <script src="http://code.jquery.com/jquery-latest.js"></ script> <script> $(document).ready(function(){ ! $("tr:nth-child(odd) td").addClass("odd"); }); </script> Friday, 15 October 2010
  • 98. Scripts that “fix IE” http://www.keithclark.co.uk/labs/ie-css3/ http://ecsstender.org Friday, 15 October 2010
  • 99. Thank you. Friday, 15 October 2010