1 / 8

Advanced CSS selectors

Advanced CSS selectors. Matt Brendzel GA Boston Programs Producer. William Neely CEO, Piecewise.com . layout. Of type. Class of type ID of type Syntax: ElementSelector div#container ul.aList. Ancestors and Children. <div> < ul id=“ firstUL ”> <li> < ul id=“ secondUL ”></ ul >

tevin
Télécharger la présentation

Advanced CSS selectors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced CSS selectors Matt Brendzel GA Boston Programs Producer William Neely CEO, Piecewise.com

  2. layout Of type Class of type ID of type Syntax: ElementSelector • div#container • ul.aList

  3. Ancestors and Children • <div> • <ul id=“firstUL”> • <li> • <ul id=“secondUL”></ul> • </li> • </ul> • </div> • Background to firstUL • Background to secondUL • Background to both Ancestor selector • Syntax: parent ancestor • div ul • Selects all ul that are ancestors of a div Child select • Syntax: Parent > child • Div > ul • Selects all ul that are direct descendants of a div

  4. First-Child, Last-Child,Nth-child <div> • <div></div> • <div></div> • <div></div> • <div></div> • <div></div> • <div></div> </div> First-child • Syntax: element:first-child • div:first-child Last-child • Syntax: element:last-child • Div:last-child Nth-child • Syntax: element:nth-child(formula) • Formula values • Even • odd • Formula with n (n starts at 0) • an+b (analogous to mx+b=y)

  5. Siblings <div> • <div id=“first”></div> • <ul id=“sec”></ul> • <div id=“third”></div> </div> Next sibling • Syntax: element+element • Ul+div Previous sibling • Syntax: element~element • Ul~div

  6. Attribute and empty <div> • <input type=“text”> • <input type=“checkbox”> • <input type=“submit”> </div> <ul> </ul> <ul> • <li>some stuff</li> </ul> Empty • Syntax: element:empty • ul:empty Syntax: [attribute] • [type] Type with specific value • Syntax: [attribute=value] • input[type=text]

  7. Not and combinations Not • Excludes matched elements • Syntax: element:not(selector) • div:not(#container) Combinations • ulli:not(:first-child) • div > [type=text]:first-child • ul.aList > li:last-childdiv:not(:empty)

  8. Full list http://www.w3schools.com/cssref/css_selectors.asp

More Related