11-32-image-filter-function.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>The image filter function</title>
  6. <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:700" rel="stylesheet" type="text/css">
  7. <style>
  8. .figure {
  9. color: #fff;
  10. background-image: url(img/saturn.png);
  11. background-repeat: no-repeat;
  12. background-position: 50% 50%;
  13. background-size: contain;
  14. background-color: #312b2b;
  15. width: 20em;
  16. min-height: 10em;
  17. margin: 2em;
  18. display: -webkit-flex;
  19. display: -ms-flexbox;
  20. display: -webkit-box;
  21. display: -moz-box;
  22. display: flex;
  23. -webkit-box-align: center;
  24. -webkit-align-items: center;
  25. -moz-box-align: center;
  26. -ms-flex-align: center;
  27. align-items: center;
  28. -webkit-box-pack: center;
  29. -webkit-justify-content: center;
  30. -moz-box-pack: center;
  31. -ms-flex-pack: center;
  32. justify-content: center;
  33. float: left;
  34. }
  35. .figure-filtered {
  36. background-image: filter(url(img/saturn.png), grayscale(1) opacity(0.4));
  37. }
  38. h2 {
  39. font-family: Roboto Condensed, Roboto, Arial, sans-serif;
  40. text-transform: uppercase;
  41. letter-spacing: 0.2em;
  42. }
  43. </style>
  44. </head>
  45. <body>
  46. <div class="figure">
  47. <h2>Saturn</h2>
  48. </div>
  49. <div class="figure figure-filtered">
  50. <h2>Saturn</h2>
  51. </div>
  52. </body>
  53. </html>