Elevation - 图1

Elevation

Shadows provide important visual cues about objects’ depth and directional movement. They are the only visual cue indicating the amount of separation between surfaces. An object’s elevation determines the appearance of its shadow. The elevation values are in range from 0 to 24.

Elevation can be added to any element by adding elevation-0, elevation-1, …, elevation-24 classes.

To add different elevation only on hover (desktop), you can use elevation-hover-0, elevation-hover-1, …, elevation-hover-24 classes.

To specify elevation only when item pressed, you can use elevation-pressed-0, elevation-pressed-1, …, elevation-pressed-24 classes.

To add transition between elevation changes (when elevation-$n, elevation-hover-$n and elevation-pressed-$n used together) we can add elevation-transition class to element, it will set 200ms transition duration. To use different duration we can use one of elevation-transition-100, elevation-transition-200, …, elevation-transition-500 classes.

CSS Variables

Below is the list of related CSS variables (CSS custom properties).

  1. :root {
  2. --f7-elevation-0: 0px 0px 0px 0px rgba(0, 0, 0, 0);
  3. --f7-elevation-1: 0px 2px 1px -1px rgba(0, 0, 0, 0.2),
  4. 0px 1px 1px 0px rgba(0, 0, 0, 0.14),
  5. 0px 1px 3px 0px rgba(0, 0, 0, 0.12);
  6. --f7-elevation-2: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
  7. 0px 2px 2px 0px rgba(0, 0, 0, 0.14),
  8. 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
  9. --f7-elevation-3: 0px 3px 3px -2px rgba(0, 0, 0, 0.2),
  10. 0px 3px 4px 0px rgba(0, 0, 0, 0.14),
  11. 0px 1px 8px 0px rgba(0, 0, 0, 0.12);
  12. --f7-elevation-4: 0px 2px 4px -1px rgba(0, 0, 0, 0.2),
  13. 0px 4px 5px 0px rgba(0, 0, 0, 0.14),
  14. 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
  15. --f7-elevation-5: 0px 3px 5px -1px rgba(0, 0, 0, 0.2),
  16. 0px 5px 8px 0px rgba(0, 0, 0, 0.14),
  17. 0px 1px 14px 0px rgba(0, 0, 0, 0.12);
  18. --f7-elevation-6: 0px 3px 5px -1px rgba(0, 0, 0, 0.2),
  19. 0px 6px 10px 0px rgba(0, 0, 0, 0.14),
  20. 0px 1px 18px 0px rgba(0, 0, 0, 0.12);
  21. --f7-elevation-7: 0px 4px 5px -2px rgba(0, 0, 0, 0.2),
  22. 0px 7px 10px 1px rgba(0, 0, 0, 0.14),
  23. 0px 2px 16px 1px rgba(0, 0, 0, 0.12);
  24. --f7-elevation-8: 0px 5px 5px -3px rgba(0, 0, 0, 0.2),
  25. 0px 8px 10px 1px rgba(0, 0, 0, 0.14),
  26. 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
  27. --f7-elevation-9: 0px 5px 6px -3px rgba(0, 0, 0, 0.2),
  28. 0px 9px 12px 1px rgba(0, 0, 0, 0.14),
  29. 0px 3px 16px 2px rgba(0, 0, 0, 0.12);
  30. --f7-elevation-10: 0px 6px 6px -3px rgba(0, 0, 0, 0.2),
  31. 0px 10px 14px 1px rgba(0, 0, 0, 0.14),
  32. 0px 4px 18px 3px rgba(0, 0, 0, 0.12);
  33. --f7-elevation-11: 0px 6px 7px -4px rgba(0, 0, 0, 0.2),
  34. 0px 11px 15px 1px rgba(0, 0, 0, 0.14),
  35. 0px 4px 20px 3px rgba(0, 0, 0, 0.12);
  36. --f7-elevation-12: 0px 7px 8px -4px rgba(0, 0, 0, 0.2),
  37. 0px 12px 17px 2px rgba(0, 0, 0, 0.14),
  38. 0px 5px 22px 4px rgba(0, 0, 0, 0.12);
  39. --f7-elevation-13: 0px 7px 8px -4px rgba(0, 0, 0, 0.2),
  40. 0px 13px 19px 2px rgba(0, 0, 0, 0.14),
  41. 0px 5px 24px 4px rgba(0, 0, 0, 0.12);
  42. --f7-elevation-14: 0px 7px 9px -4px rgba(0, 0, 0, 0.2),
  43. 0px 14px 21px 2px rgba(0, 0, 0, 0.14),
  44. 0px 5px 26px 4px rgba(0, 0, 0, 0.12);
  45. --f7-elevation-15: 0px 8px 9px -5px rgba(0, 0, 0, 0.2),
  46. 0px 15px 22px 2px rgba(0, 0, 0, 0.14),
  47. 0px 6px 28px 5px rgba(0, 0, 0, 0.12);
  48. --f7-elevation-16: 0px 8px 10px -5px rgba(0, 0, 0, 0.2),
  49. 0px 16px 24px 2px rgba(0, 0, 0, 0.14),
  50. 0px 6px 30px 5px rgba(0, 0, 0, 0.12);
  51. --f7-elevation-17: 0px 8px 11px -5px rgba(0, 0, 0, 0.2),
  52. 0px 17px 26px 2px rgba(0, 0, 0, 0.14),
  53. 0px 6px 32px 5px rgba(0, 0, 0, 0.12);
  54. --f7-elevation-18: 0px 9px 11px -5px rgba(0, 0, 0, 0.2),
  55. 0px 18px 28px 2px rgba(0, 0, 0, 0.14),
  56. 0px 7px 34px 6px rgba(0, 0, 0, 0.12);
  57. --f7-elevation-19: 0px 9px 12px -6px rgba(0, 0, 0, 0.2),
  58. 0px 19px 29px 2px rgba(0, 0, 0, 0.14),
  59. 0px 7px 36px 6px rgba(0, 0, 0, 0.12);
  60. --f7-elevation-20: 0px 10px 13px -6px rgba(0, 0, 0, 0.2),
  61. 0px 20px 31px 3px rgba(0, 0, 0, 0.14),
  62. 0px 8px 38px 7px rgba(0, 0, 0, 0.12);
  63. --f7-elevation-21: 0px 10px 13px -6px rgba(0, 0, 0, 0.2),
  64. 0px 21px 33px 3px rgba(0, 0, 0, 0.14),
  65. 0px 8px 40px 7px rgba(0, 0, 0, 0.12);
  66. --f7-elevation-22: 0px 10px 14px -6px rgba(0, 0, 0, 0.2),
  67. 0px 22px 35px 3px rgba(0, 0, 0, 0.14),
  68. 0px 8px 42px 7px rgba(0, 0, 0, 0.12);
  69. --f7-elevation-23: 0px 11px 14px -7px rgba(0, 0, 0, 0.2),
  70. 0px 23px 36px 3px rgba(0, 0, 0, 0.14),
  71. 0px 9px 44px 8px rgba(0, 0, 0, 0.12);
  72. --f7-elevation-24: 0px 11px 15px -7px rgba(0, 0, 0, 0.2),
  73. 0px 24px 38px 3px rgba(0, 0, 0, 0.14),
  74. 0px 9px 46px 8px rgba(0, 0, 0, 0.12);
  75. }

Example

  1. <div class="row">
  2. <div class="col">
  3. <div class="elevation-1">1</div>
  4. </div>
  5. <div class="col">
  6. <div class="elevation-2">2</div>
  7. </div>
  8. <div class="col">
  9. <div class="elevation-3">3</div>
  10. </div>
  11. </div>
  12. <div class="row">
  13. <div class="col">
  14. <div class="elevation-4">4</div>
  15. </div>
  16. <div class="col">
  17. <div class="elevation-5">5</div>
  18. </div>
  19. <div class="col">
  20. <div class="elevation-6">6</div>
  21. </div>
  22. </div>
  23. <div class="row">
  24. <div class="col">
  25. <div class="elevation-7">7</div>
  26. </div>
  27. <div class="col">
  28. <div class="elevation-8">8</div>
  29. </div>
  30. <div class="col">
  31. <div class="elevation-9">9</div>
  32. </div>
  33. </div>
  34. <div class="row">
  35. <div class="col">
  36. <div class="elevation-10">10</div>
  37. </div>
  38. <div class="col">
  39. <div class="elevation-11">11</div>
  40. </div>
  41. <div class="col">
  42. <div class="elevation-12">12</div>
  43. </div>
  44. </div>
  45. <div class="row">
  46. <div class="col">
  47. <div class="elevation-13">13</div>
  48. </div>
  49. <div class="col">
  50. <div class="elevation-14">14</div>
  51. </div>
  52. <div class="col">
  53. <div class="elevation-15">15</div>
  54. </div>
  55. </div>
  56. <div class="row">
  57. <div class="col">
  58. <div class="elevation-16">16</div>
  59. </div>
  60. <div class="col">
  61. <div class="elevation-17">17</div>
  62. </div>
  63. <div class="col">
  64. <div class="elevation-18">18</div>
  65. </div>
  66. </div>
  67. <div class="row">
  68. <div class="col">
  69. <div class="elevation-19">19</div>
  70. </div>
  71. <div class="col">
  72. <div class="elevation-20">20</div>
  73. </div>
  74. <div class="col">
  75. <div class="elevation-21">21</div>
  76. </div>
  77. </div>
  78. <div class="row">
  79. <div class="col">
  80. <div class="elevation-22">22</div>
  81. </div>
  82. <div class="col">
  83. <div class="elevation-23">23</div>
  84. </div>
  85. <div class="col">
  86. <div class="elevation-24">24</div>
  87. </div>
  88. </div>
  1. <div class="row">
  2. <div class="col">
  3. <div class="elevation-demo elevation-6 elevation-hover-24 elevation-pressed-12 elevation-transition">6 + hover-24 + pressed-12</div>
  4. </div>
  5. </div>

← Dialog

Floating Action Button / FAB →