cesarnascimento

css

Aug 7th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. @import "compass/css3";
  2.  
  3. // More practical CSS...
  4. // using mobile first method (IE8,7 requires respond.js polyfill https://github.com/scottjehl/Respond)
  5.  
  6. $breakpoint-alpha: 480px; // adjust to your needs
  7.  
  8. .rwd-table {
  9. margin: 1em 0;
  10. min-width: 300px; // adjust to your needs
  11.  
  12. tr {
  13. border-top: 1px solid #ddd;
  14. border-bottom: 1px solid #ddd;
  15. }
  16.  
  17. th {
  18. display: none; // for accessibility, use a visually hidden method here instead! Thanks, reddit!
  19. }
  20.  
  21. td {
  22. display: block;
  23.  
  24. &:first-child {
  25. padding-top: .5em;
  26. }
  27. &:last-child {
  28. padding-bottom: .5em;
  29. }
  30.  
  31. &:before {
  32. content: attr(data-th)": "; // who knew you could do this? The internet, that's who.
  33. font-weight: bold;
  34.  
  35. // optional stuff to make it look nicer
  36. width: 6.5em; // magic number :( adjust according to your own content
  37. display: inline-block;
  38. // end options
  39.  
  40. @media (min-width: $breakpoint-alpha) {
  41. display: none;
  42. }
  43. }
  44. }
  45.  
  46. th, td {
  47. text-align: left;
  48.  
  49. @media (min-width: $breakpoint-alpha) {
  50. display: table-cell;
  51. padding: .25em .5em;
  52.  
  53. &:first-child {
  54. padding-left: 0;
  55. }
  56.  
  57. &:last-child {
  58. padding-right: 0;
  59. }
  60. }
  61.  
  62. }
  63.  
  64.  
  65. }
  66.  
  67.  
  68. // presentational styling
  69.  
  70. @import 'https://fonts.googleapis.com/css?family=Montserrat:300,400,700';
  71.  
  72. body {
  73. padding: 0 2em;
  74. font-family: Montserrat, sans-serif;
  75. -webkit-font-smoothing: antialiased;
  76. text-rendering: optimizeLegibility;
  77. color: #444;
  78. background: #eee;
  79. }
  80.  
  81. h1 {
  82. font-weight: normal;
  83. letter-spacing: -1px;
  84. color: #34495E;
  85. }
  86.  
  87. .rwd-table {
  88. background: #34495E;
  89. color: #fff;
  90. border-radius: .4em;
  91. overflow: hidden;
  92. tr {
  93. border-color: lighten(#34495E, 10%);
  94. }
  95. th, td {
  96. margin: .5em 1em;
  97. @media (min-width: $breakpoint-alpha) {
  98. padding: 1em !important;
  99. }
  100. }
  101. th, td:before {
  102. color: #dd5;
  103. }
  104. }
Add Comment
Please, Sign In to add comment