css 4 - what's coming up

53
A BRIEF INTRODUCTION ABOUT CSS LEVEL 4 Diego Eis tableless.com.br

Upload: diego-eis

Post on 14-Jul-2015

1.027 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: CSS 4 - What's coming up

A BRIEF INTRODUCTION ABOUT CSS LEVEL 4

Diego Eis tableless.com.br

Page 2: CSS 4 - What's coming up

Diego EisI love work with web. And I lost 37 pounds. ;-)

@diegoeis @tableless

http://tableless.com.br http://medium.com/@diegoeis http://slideshare.net/diegoeis

Page 3: CSS 4 - What's coming up
Page 4: CSS 4 - What's coming up
Page 5: CSS 4 - What's coming up

CSS Level 3Was all about shadows, borders, backgrounds, 3D, transitions and animations.

Page 6: CSS 4 - What's coming up

This was awesome!Because this solved many problems. Do you remember when you created rounded borders with four images, or created opacity background with PNG, or even used many DIVs to produce multiple backgrounds?

Page 7: CSS 4 - What's coming up

CSS Level 4Is all about select and detect things.

Page 8: CSS 4 - What's coming up

Sure, CSS Level 4 can do more than that, but most important

is select and detect things.

#IMHO

Page 9: CSS 4 - What's coming up

SelectorsNew selectors are coming.

Page 10: CSS 4 - What's coming up

Parent selectorSelect a parent element based on its child.

Page 11: CSS 4 - What's coming up
Page 12: CSS 4 - What's coming up

// Select LI that is a parent of P $li > p { border: 1px solid #ccc; }

Page 13: CSS 4 - What's coming up

Logical CombinatorsSelect a collection of elements.

Page 14: CSS 4 - What's coming up

:matches()Functional pseudo-class select elements contained in selector list argument.

Page 15: CSS 4 - What's coming up

// Old waysection h1, header h1, article h1 { color: blue;}

Page 16: CSS 4 - What's coming up

// select H1 contained in section, header or article elements:matches(section, header, article) h1 { color: blue;}

Page 17: CSS 4 - What's coming up

:not()Functional pseudo-class with selector list as argument that NOT is represented by this argument.

Page 18: CSS 4 - What's coming up

button:not([DISABLED]) { ... }

div:not(.container) { margin-top: 50px; }

Page 19: CSS 4 - What's coming up

Functional pseudo-class that taking a relative selector list as an argument.

:has()

Page 20: CSS 4 - What's coming up

// Select only A element that contain an <img> childa:has(> img) { ... }

// Select a section element, that NOT HAS these elementssection:not(:has(h1, h2, h3, h4, h5, h6)) { ... }

Page 21: CSS 4 - What's coming up

New Pseudo-ClassesA bunch of new pseudo-classes to make our life easier.

Page 22: CSS 4 - What's coming up

Linguistic Pseudo-ClassIdentify language direction. Select an element that have your content with a specific value of attribute lang.

Page 23: CSS 4 - What's coming up

@eshiota

Page 24: CSS 4 - What's coming up

:dir()Select element based on language direction of read.

Page 25: CSS 4 - What's coming up

// Left-to-right read directionp:dir(ltr) { color: black; }

// Right-to-left read directionp:dir(rtl) { color: gray; }

Page 26: CSS 4 - What's coming up

:lang()Select element based on language attribute.

Page 27: CSS 4 - What's coming up

// Paragraph with lang=“pt-br" definedp:lang(pt-br) { color: blue; }

Page 28: CSS 4 - What's coming up

The Input Pseudo-classesThe pseudo-classes applied to elements that take user input, like form fields.

Page 29: CSS 4 - What's coming up

// When the field is enabledinput[type="text"]:enabled { ... }

// When the field is disabledinput[type="text"]:disabled { ... }

// When the field is read-onlyinput[type="text”]:read-only { ... }

// When field is showing the placeholder attr textinput[type="text”]:placeholder-shown { ... }

// When the field is checked[type=“checkbox”]:checked,[type=“radio”]:checked { ... }

Page 30: CSS 4 - What's coming up

Selecting Highlighted ContentStyle a portion of document that have been highlighted by the user in some way.

Page 31: CSS 4 - What's coming up

// When the user select the text of Pp::selection { background: green; color: yellow; }

// When the browser flag a text as misspelled::spelling-error { color: red; }

// When the browser flag a text as grammatically incorrect::grammar-error { color: red; }

Page 32: CSS 4 - What's coming up

Time-dimensional Pseudo-classesselects elements that will be or have been spoken or displayed, like in screen readers or even subtitles.

Page 33: CSS 4 - What's coming up

// Select paragraph that is showing on screen or are spokenp:current { background: black; color: white; }

// Grouping many elements:current(p, li, dt, dd) { color: white; }

p:future { color: gray; }

p:past { color: red; }

Page 34: CSS 4 - What's coming up

Work Draft of Selectors 4http://www.w3.org/TR/selectors4/

Page 35: CSS 4 - What's coming up

All about Media QueriesThe Responsive Web Design is 90% based on Media Queries, but Media Queries is very limited. Media Queries Level 4 promise change that.

Page 36: CSS 4 - What's coming up

Media FeaturesMedia Features test a single specific feature of user agent or display device. We divided in two types: discrete or range.

Page 37: CSS 4 - What's coming up

Environment Media FeaturesLight-level use the ambient light to determine what style you will apply.

Page 38: CSS 4 - What's coming up

// Very dark@media (light-level: normal) { ...}

// Normal@media (light-level: dim) { ...}

// Very light@media (light-level: washed) { ...}

Page 39: CSS 4 - What's coming up

Scripting Media FeaturesDetect if the actual UA support script languages on the current document.

Page 40: CSS 4 - What's coming up

// The the UA supports scripting and that support is active@media (scripting: enabled) { ...}

// Indicate that scripting is active when page loads, but not afterwards. Like printed pages.@media (scripting: initial-only) { ...}

// Indicates that the UA will not run, not support or the support isn’t active@media (scripting: none) { ...}

Page 41: CSS 4 - What's coming up

Interaction Media FeaturesDetect the presence and accuracy of the pointing device, such as a mouse.

Page 42: CSS 4 - What's coming up

// The primary input mechanism does not include a pointing device@media (pointer: none) { ...}

// The mechanism include pointing device of limited accuracy@media (pointer: coarse) { ...}

// Detect if mechanism include accurate pointing device@media (pointer: fine) { ...}

Page 43: CSS 4 - What's coming up

resolutionDetect the resolution of output device.

Page 44: CSS 4 - What's coming up

@media (resolution >= 2dppx) { ... }

@media print and (min-resolution: 300dpi) { ... }

Page 45: CSS 4 - What's coming up

Color Media FeaturesAnalyse the color ability of device.

Page 46: CSS 4 - What's coming up

colorDetect the number of bits per color component of the output device.

Page 47: CSS 4 - What's coming up

// Apply to color devices at least 8 bits@media (color >= 8) { ... }

// This device support at least 256 color

Page 48: CSS 4 - What's coming up

monochromeDetect the number of bits per pixel in a monochrome frame buffer.

Page 49: CSS 4 - What's coming up

// Apply to device with more than 2 bits per pixels@media (monochrome >= 2) { ... }

// One style for color pages and another for monochrome@media print and (color) { ... }@media print and (monochrome) { ... }

Page 50: CSS 4 - What's coming up
Page 51: CSS 4 - What's coming up
Page 52: CSS 4 - What's coming up

Work Draft of Media Queries 4http://www.w3.org/TR/mediaqueries-4/

Page 53: CSS 4 - What's coming up

Goodbye!Let me know what you think!

@diegoeis @tableless

http://tableless.com.br http://medium.com/@diegoeis http://slideshare.net/diegoeis