Slide 1

Slide 1 text

The Power of the Plus Creative Solutions with CSS Selectors @webcraftsman

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

CSS is something you can learn in a day (or a couple of days) but takes a lifetime to master.

Slide 8

Slide 8 text

1 Man Team Bonnier Corp. • Small Websites • Control over the code • Small CSS files • Larger Websites • CMS • Larger CSS files

Slide 9

Slide 9 text

http://net.tutplus.tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Adjacent Sibling Combinator E + F

Slide 12

Slide 12 text

HTML

Heading

This is the paragraph I want to target

There are other paragraphs.

There are other paragraphs.

CSS h2 + p { color: black; } Adjacent Sibling Combinator

Slide 13

Slide 13 text

Heading This is the paragraph I want to target. There are other paragraphs. There are other paragraphs. Adjacent Sibling Combinator

Slide 14

Slide 14 text

Child Combinator E > F

Slide 15

Slide 15 text

Slide 16

Slide 16 text

CSS .site-map > li { float: left; margin-left: 15px; overflow: hidden; }

Slide 17

Slide 17 text

Why had these selectors not become a part of my toolbox? • Browser Support • Control over my code

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

My solution .recipe-page .body h4 + p > b { font-weight: normal; } .recipe-page .body h4 + div b { font-weight: normal; } .recipe-page .body h4 ~ span { font-weight: normal !important; }

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

.rating + .rating-buttons > .write-comment, .comment-counts-text + .rating + .rating-buttons > .rate-review, .comment-counts-text + .rating-buttons > .rate-review, .comment-counts-text + .rating-buttons > .write-comment { display: none; } My solution

Slide 26

Slide 26 text

My solution .comment-counts-number.over9999 + .comment-counts-text { margin-top: 0; } .rating { margin-left: 6px; margin-top: 6px; } .comment-counts-text + .rating { margin-top: 0; }

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

http://css-tricks.com/the-checkbox-hack/

Slide 33

Slide 33 text

Title of Food Blog Nominated
My solution

Slide 34

Slide 34 text

My solution
Title of Food Blog Nominated

Slide 35

Slide 35 text

My solution
Title of Food Blog Nominated

Slide 36

Slide 36 text

.vote-on-item input { left:0; height: 170px; opacity: 0; filter: alpha(opacity = 0); outline: 0; position: absolute; top:0; width: 186px; z-index:2; } My solution

Slide 37

Slide 37 text

.vote-on-item label { border: 5px solid #222222; } .vote-on-item flag {display: none;} .vote-on-item input:checked + label { border-color:#cc000b; } .vote-on-item input:checked + label .flag { background: transparent url(check.png) no-repeat; display: block; height: 66px; left:7px; position: absolute; top:-5px; width: 46px; }

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Performance

Slide 40

Slide 40 text

Performance 1.id (#myid) 2.class (.myclass) 3.tag (div, h1, p) 4.adjacent sibling (h1 + p) 5.child (ul > li) 6.descendent (li a) 7.universal (*) 8.attribute (a[rel="external"]) 9.pseudo-class and pseudo element (a:hover, li:first)

Slide 41

Slide 41 text

Performance 1.id (#myid) 2.class (.myclass) 3.tag (div, h1, p) 4.adjacent sibling (h1 + p) 5.child (ul > li) 6.descendent (li a) 7.universal (*) 8.attribute (a[rel="external"]) 9.pseudo-class and pseudo element (a:hover, li:first) http://csswizardry.com/2011/09/writing-efficient-css-selectors/

Slide 42

Slide 42 text

http://net.tutplus.tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/

Slide 43

Slide 43 text

http://speakerdeck.com/u/webcraftsman http://jeffbridgforth.com/front-end-talk

Slide 44

Slide 44 text

@webcraftsman

Slide 45

Slide 45 text

Thank You