grid.css 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Grid */
  2. ul.grid > li {
  3. background-size: cover;
  4. width: calc(25% - 0.2em);
  5. padding: 0;
  6. padding-bottom: 25%;
  7. float: left;
  8. position: relative;
  9. background-repeat: no-repeat;
  10. background-position: center center;
  11. box-sizing: border-box;
  12. margin: 0.1em;
  13. }
  14. ul.grid.active > li:hover {
  15. cursor: pointer;
  16. }
  17. ul.grid > li > nav {
  18. position: absolute;
  19. bottom: 0;
  20. color: white;
  21. background-color: rgba(0, 0, 0, 0.5);
  22. width: 100%;
  23. padding: 0 1rem;
  24. box-sizing: border-box;
  25. white-space: nowrap;
  26. text-overflow: ellipsis;
  27. overflow: hidden;
  28. font-size: 2rem;
  29. line-height: 5rem;
  30. }
  31. @media screen and (max-width: 1024px) {
  32. ul.grid > li {
  33. width: calc(33.33% - 0.2em);
  34. padding-bottom: 33.33%;
  35. }
  36. }
  37. @media screen and (max-width: 640px) {
  38. ul.grid > li {
  39. width: calc(50% - 0.2em);
  40. padding-bottom: 50%;
  41. }
  42. }
  43. ul.grid:after {
  44. content: "";
  45. display: block;
  46. clear: both;
  47. }
  48. ul.grid.padded {
  49. padding: 0;
  50. }