gridism.css 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Gridism
  3. * A simple, responsive, and handy CSS grid by @cobyism
  4. * https://github.com/cobyism/gridism
  5. */
  6. /* Preserve some sanity */
  7. .grid,
  8. .unit {
  9. -webkit-box-sizing: border-box;
  10. -moz-box-sizing: border-box;
  11. box-sizing: border-box;
  12. }
  13. /* Set up some rules to govern the grid */
  14. .grid {
  15. display: block;
  16. clear: both;
  17. }
  18. .grid .unit {
  19. float: left;
  20. width: 100%;
  21. padding: 10px;
  22. }
  23. /* This ensures the outer gutters are equal to the (doubled) inner gutters. */
  24. .grid .unit:first-child { padding-left: 20px; }
  25. .grid .unit:last-child { padding-right: 20px; }
  26. /* Nested grids already have padding though, so let's nuke it */
  27. .unit .unit:first-child { padding-left: 0; }
  28. .unit .unit:last-child { padding-right: 0; }
  29. .unit .grid:first-child > .unit { padding-top: 0; }
  30. .unit .grid:last-child > .unit { padding-bottom: 0; }
  31. /* Let people nuke the gutters/padding completely in a couple of ways */
  32. .no-gutters .unit,
  33. .unit.no-gutters {
  34. padding: 0 !important;
  35. }
  36. /* Wrapping at a maximum width is optional */
  37. .wrap .grid,
  38. .grid.wrap {
  39. max-width: 978px;
  40. margin: 0 auto;
  41. }
  42. /* Width classes also have shorthand versions numbered as fractions
  43. * For example: for a grid unit 1/3 (one third) of the parent width,
  44. * simply apply class="w-1-3" to the element. */
  45. .grid .whole, .grid .w-1-1 { width: 100%; }
  46. .grid .half, .grid .w-1-2 { width: 50%; }
  47. .grid .one-third, .grid .w-1-3 { width: 33.3332%; }
  48. .grid .two-thirds, .grid .w-2-3 { width: 66.6665%; }
  49. .grid .one-quarter,
  50. .grid .one-fourth, .grid .w-1-4 { width: 25%; }
  51. .grid .three-quarters,
  52. .grid .three-fourths, .grid .w-3-4 { width: 75%; }
  53. .grid .one-fifth, .grid .w-1-5 { width: 20%; }
  54. .grid .two-fifths, .grid .w-2-5 { width: 40%; }
  55. .grid .three-fifths, .grid .w-3-5 { width: 60%; }
  56. .grid .four-fifths, .grid .w-4-5 { width: 80%; }
  57. .grid .golden-small, .grid .w-g-s { width: 38.2716%; } /* Golden section: smaller piece */
  58. .grid .golden-large, .grid .w-g-l { width: 61.7283%; } /* Golden section: larger piece */
  59. /* Clearfix after every .grid */
  60. .grid {
  61. *zoom: 1;
  62. }
  63. .grid:before, .grid:after {
  64. display: table;
  65. content: "";
  66. line-height: 0;
  67. }
  68. .grid:after {
  69. clear: both;
  70. }
  71. /* Utility classes */
  72. .align-center { text-align: center; }
  73. .align-left { text-align: left; }
  74. .align-right { text-align: right; }
  75. .pull-left { float: left; }
  76. .pull-right { float: right; }
  77. /* A property for a better rendering of images in units: in
  78. this way bigger pictures are just resized if the unit
  79. becomes smaller */
  80. .unit img {
  81. max-width: 100%;
  82. }
  83. /* Hide elements using this class by default */
  84. .only-on-mobiles {
  85. display: none !important;
  86. }
  87. /* Responsive Stuff */
  88. @media screen and (max-width: 568px) {
  89. /* Stack anything that isn't full-width on smaller screens
  90. and doesn't provide the no-stacking-on-mobiles class */
  91. .grid:not(.no-stacking-on-mobiles) > .unit {
  92. width: 100% !important;
  93. padding-left: 20px;
  94. padding-right: 20px;
  95. }
  96. .unit .grid .unit {
  97. padding-left: 0px;
  98. padding-right: 0px;
  99. }
  100. /* Sometimes, you just want to be different on small screens */
  101. .center-on-mobiles {
  102. text-align: center !important;
  103. }
  104. .hide-on-mobiles {
  105. display: none !important;
  106. }
  107. .only-on-mobiles {
  108. display: block !important;
  109. }
  110. }
  111. /* Expand the wrap a bit further on larger screens */
  112. @media screen and (min-width: 1180px) {
  113. .wider .grid,
  114. .grid.wider {
  115. max-width: 1180px;
  116. margin: 0 auto;
  117. }
  118. }