8
CSS SELECTORS by Noe Lopez

Browser Hacks and Nth-chind class selectors

Embed Size (px)

DESCRIPTION

Short presentation on browser targeting media queries and nth-child() class selectors.

Citation preview

Page 1: Browser Hacks and Nth-chind class selectors

CSS SELECTORS

byNoe Lopez

Page 2: Browser Hacks and Nth-chind class selectors

Mailto Syntax

<a href=”mailto:[email protected]> What everyone uses:

It works, but what if you want the email to go to more than 1 recipient, and include a subject line?

<a href=”mailto:[email protected], [email protected]?subject=website-email”>

Page 3: Browser Hacks and Nth-chind class selectors

Targeting Chrome and Safari Browser

@media screen and (-webkit-min-device-pixel-ratio:0) {body {

background: #54K37R;}

}

The elements will only take effect on chrome and safari browsers.

Page 4: Browser Hacks and Nth-chind class selectors

Targeting Firefox Browser

@-moz-document url-prefix() {p {

background: #54K37R; margin: 23px 45px 32px 90px}

}

The elements will only take effect on Firefox browsers.

Page 5: Browser Hacks and Nth-chind class selectors

IE needs love too

p {background: #54K37R;

margin: 23px 45px 32px 90px\9; margin: 23px 45px 32px 90px;

}

The elements will only take effect on Firefox browsers.

Well internet explorer you get love too, using a backslash followed by a nine (\9) after an element will automatically target only ie browsers version 6 and up.

Page 6: Browser Hacks and Nth-chind class selectors

[rel=x]

<a rel=”external”> page title</a>

If no class or id is available using a simple “rel” element can do the job.

a [rel=”extenal”] {color: #561FDB;text-transform: uppercase;}

The rel elements can be really useful when targeting images, and links within untouchable html.

Page 7: Browser Hacks and Nth-chind class selectors

Nth-Childs

nth-child is one of the most powerful elements in CSS. It can be applied to any element in number sequence. In the example the 3rd paragraph will be all upper case and have a different background.

p:nth-child(3) {background: #561FDB;text-transform: uppercase;}

p:last-child {background: #F81256;text-transform: uppercase;}

p:first-child {background: #1270F8;text-transform: uppercase;}

Page 8: Browser Hacks and Nth-chind class selectors

{Questions}

Mailto Syntax

Browser targets[rel=x]

nth-child(){}

first-child{}

last-child{}