Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

7Masters CSS | CSS Level 4, por Diego Eis

1,738 views

Published on

Fundador do Tablelesse atual coordenador do time de Front-end da Locaweb, Diego Eis apresentou alguns aspectos do CSS 4.

Published in: Technology
  • Be the first to comment

7Masters CSS | CSS Level 4, por Diego Eis

  1. 1. A BRIEF INTRODUCTION ABOUT CSS LEVEL 4 Diego Eis tableless.com.br
  2. 2. Diego Eis I love work with web. And I lost 37 pounds. ;-) @diegoeis @tableless http://tableless.com.br http://medium.com/@diegoeis http://slideshare.net/diegoeis
  3. 3. CSS Level 3 Was all about shadows, borders, backgrounds, 3D, transitions and animations.
  4. 4. 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?
  5. 5. CSS Level 4 Is all about select and detect things.
  6. 6. Sure, CSS Level 4 can do more than that, but most important is select and detect things. #IMHO
  7. 7. Selectors New selectors are coming.
  8. 8. Parent selector Select a parent element based on its child.
  9. 9. // Select LI that is a parent of P $li > p { border: 1px solid #ccc; }
  10. 10. Logical Combinators Select a collection of elements.
  11. 11. :matches() Functional pseudo-class select elements contained in selector list argument.
  12. 12. // select H1 contained in section, header or article elements :matches(section, header, article) h1 { color: blue; }
  13. 13. :not() Functional pseudo-class with selector list as argument that NOT is represented by this argument.
  14. 14. button:not([DISABLED]) { ... }
  15. 15. Functional pseudo-class that taking a relative selector list as an argument. :has()
  16. 16. // Select only A element that contain an <img> child a:has(> img) { ... } // Select a section element, that NOT HAS these elements section:not(:has(h1, h2, h3, h4, h5, h6)) { ... }
  17. 17. Linguistic Pseudo-Class Identify language direction.
  18. 18. @eshiota
  19. 19. // Left-to-right read direction p:dir(ltr) { color: black; } // Right-to-left read direction p:dir(rtl) { color: gray; }
  20. 20. The Input Pseudo-classes The pseudo-classes applied to elements that take user input, like form fields.
  21. 21. // When the field is enabled input[type="text"]:enabled { ... } // When the field is disabled input[type="text"]:disabled { ... } // When the field is read-only input[type="text”]:read-only { ... } // When field is showing the placeholder attr text input[type="text”]:placeholder-shown { ... } // When the field is checked [type=“checkbox”]:checked, [type=“radio”]:checked { ... }
  22. 22. Selecting Highlighted Content Style a portion of document that have been highlighted by the user in some way.
  23. 23. // When the user select the text of P p::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; }
  24. 24. Work Draft of Selectors 4 http://www.w3.org/TR/selectors4/
  25. 25. Smart Media Queries The Responsive Web Design is 90% based on Media Queries, but Media Queries is very limited. Media Queries Level 4 promise change that.
  26. 26. Media Features Media Features test a single specific feature of user agent or display device. We divided in two types: discrete or range.
  27. 27. Discrete type Discrete media feature take their values from a set. The values can be keywords or boolean.
  28. 28. Environment Media Features Light-level use the ambient light to determine what style you will apply.
  29. 29. // Very dark @media (light-level: normal) { ... } // Normal @media (light-level: dim) { ... } // Very light @media (light-level: washed) { ... }
  30. 30. Scripting Media Features Detect if the actual UA support script languages on the current document.
  31. 31. // 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) { ... }
  32. 32. Interaction Media Features Detect the presence and accuracy of the pointing device, such as a mouse.
  33. 33. // 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) { ... }
  34. 34. Range type Range media feature take their values from a range. Two values can be compared to see which is lesser and which is greater.
  35. 35. Display Quality Media Features Detect characteristics of display of actual media.
  36. 36. resolution Detect the resolution of output device.
  37. 37. @media (resolution >= 2dppx) { ... } @media print and (min-resolution: 300dpi) { ... }
  38. 38. grid Detect 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.
  39. 39. @media (grid) and (max-width: 15em) { ... }
  40. 40. Color Media Features Analyse the color ability of device.
  41. 41. color Detect the number of bits per color component of the output device.
  42. 42. // Apply to color devices at least 8 bits @media (color >= 8) { ... }
  43. 43. monochrome Detect the number of bits per pixel in a monochrome frame buffer.
  44. 44. // 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) { ... }
  45. 45. Work Draft of Media Queries 4 http://www.w3.org/TR/mediaqueries-4/
  46. 46. Goodbye! Let me know what you think! @diegoeis @tableless http://tableless.com.br http://medium.com/@diegoeis http://slideshare.net/diegoeis

×