Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. /**
  2. * Option 1Using negative paddings/margins for footer in adjacent with wrapper content with
  3. * a push element inside
  4. */
  5.  
  6. html, body {
  7. height: 100%;
  8. margin: 0;
  9. }
  10. .wrapper {
  11. min-height: 100%;
  12.  
  13. /* Equal to height of footer */
  14. /* But also accounting for potential margin-bottom of last child */
  15. margin-bottom: -50px;
  16. }
  17. .footer, push {
  18. height: 50px;
  19. }
  20.  
  21. /**
  22. * Option 2 - Same idea as option 1 but without using push element inside wrapper content
  23. *
  24. */
  25.  
  26. html, body {
  27. height: 100%;
  28. margin: 0;
  29. }
  30. .content {
  31. min-height: 100%;
  32. }
  33. .content-inside {
  34. padding: 20px;
  35. padding-bottom: 50px;
  36. }
  37. .footer {
  38. height: 50px;
  39. margin-top: -50px;
  40. }
  41.  
  42. /**
  43. * Option 3 - Using calc approach
  44. *
  45. */
  46.  
  47. .content {
  48. min-height: calc(100vh - 70px);
  49. }
  50. .footer {
  51. height: 50px;
  52. }
  53.  
  54. /**
  55. * Option 4 - Using flexbox approach
  56. *
  57. */
  58.  
  59. html, body {
  60. height: 100%;
  61. }
  62. body {
  63. display: flex;
  64. flex-direction: column;
  65. }
  66. .content {
  67. flex: 1 0 auto;
  68. }
  69.  
  70. /**
  71. * Option 6 - Using gird approach(experimental)
  72. *
  73. */
  74.  
  75. html {
  76. height: 100%;
  77. }
  78. body {
  79. min-height: 100%;
  80. display: grid;
  81. grid-template-rows: 1fr auto;
  82. }
  83. .footer {
  84. grid-row-start: 2;
  85. grid-row-end: 3;
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement