Top Banner
A BRIEF INTRODUCTION ABOUT CSS LEVEL 4 Diego Eis tableless.com.br
49
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 7Masters CSS | CSS Level 4, por Diego Eis

A BRIEF INTRODUCTION ABOUT CSS LEVEL 4

Diego Eis tableless.com.br

Page 2: 7Masters CSS | CSS Level 4, por Diego Eis

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: 7Masters CSS | CSS Level 4, por Diego Eis
Page 4: 7Masters CSS | CSS Level 4, por Diego Eis
Page 5: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 6: 7Masters CSS | CSS Level 4, por Diego Eis

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: 7Masters CSS | CSS Level 4, por Diego Eis

CSS Level 4Is all about select and detect things.

Page 8: 7Masters CSS | CSS Level 4, por Diego Eis

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

is select and detect things.

#IMHO

Page 9: 7Masters CSS | CSS Level 4, por Diego Eis

SelectorsNew selectors are coming.

Page 10: 7Masters CSS | CSS Level 4, por Diego Eis

Parent selectorSelect a parent element based on its child.

Page 11: 7Masters CSS | CSS Level 4, por Diego Eis
Page 12: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 13: 7Masters CSS | CSS Level 4, por Diego Eis

Logical CombinatorsSelect a collection of elements.

Page 14: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 15: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 16: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 17: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 18: 7Masters CSS | CSS Level 4, por Diego Eis

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

:has()

Page 19: 7Masters CSS | CSS Level 4, por Diego Eis

// 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 20: 7Masters CSS | CSS Level 4, por Diego Eis

Linguistic Pseudo-ClassIdentify language direction.

Page 21: 7Masters CSS | CSS Level 4, por Diego Eis

@eshiota

Page 22: 7Masters CSS | CSS Level 4, por Diego Eis

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

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

Page 23: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 24: 7Masters CSS | CSS Level 4, por Diego Eis

// 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 25: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 26: 7Masters CSS | CSS Level 4, por Diego Eis

// 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 27: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 28: 7Masters CSS | CSS Level 4, por Diego Eis

Smart 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 29: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 30: 7Masters CSS | CSS Level 4, por Diego Eis

Discrete typeDiscrete media feature take their values from a set. The values can be keywords or boolean.

Page 31: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 32: 7Masters CSS | CSS Level 4, por Diego Eis

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

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

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

Page 33: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 34: 7Masters CSS | CSS Level 4, por Diego Eis

// 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 35: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 36: 7Masters CSS | CSS Level 4, por Diego Eis

// 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 37: 7Masters CSS | CSS Level 4, por Diego Eis

Range typeRange media feature take their values from a range. Two values can be compared to see which is lesser and which is greater.

Page 38: 7Masters CSS | CSS Level 4, por Diego Eis

Display Quality Media FeaturesDetect characteristics of display of actual media.

Page 39: 7Masters CSS | CSS Level 4, por Diego Eis

resolutionDetect the resolution of output device.

Page 40: 7Masters CSS | CSS Level 4, por Diego Eis

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

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

Page 41: 7Masters CSS | CSS Level 4, por Diego Eis

gridDetect if the output device use some type of grid. Like some tty terminals that use one type of fixed font. This is a boolean option.

Page 42: 7Masters CSS | CSS Level 4, por Diego Eis

@media (grid) and (max-width: 15em) { ... }

Page 43: 7Masters CSS | CSS Level 4, por Diego Eis

Color Media FeaturesAnalyse the color ability of device.

Page 44: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 45: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 46: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 47: 7Masters CSS | CSS Level 4, por Diego Eis

// 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 48: 7Masters CSS | CSS Level 4, por Diego Eis

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

Page 49: 7Masters CSS | CSS Level 4, por Diego Eis

Goodbye!Let me know what you think!

@diegoeis @tableless

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