Advertisement
badlogic

media query sample

Jun 6th, 2017
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <style>
  6. * {
  7. box-sizing: border-box;
  8. }
  9. .row::after {
  10. content: "";
  11. clear: both;
  12. display: block;
  13. }
  14. [class*="col-"] {
  15. float: left;
  16. padding: 15px;
  17. }
  18. html {
  19. font-family: "Lucida Sans", sans-serif;
  20. }
  21. .header {
  22. background-color: #9933cc;
  23. color: #ffffff;
  24. padding: 15px;
  25. }
  26. .menu ul {
  27. list-style-type: none;
  28. margin: 0;
  29. padding: 0;
  30. }
  31. .menu li {
  32. padding: 8px;
  33. margin-bottom: 7px;
  34. background-color: #33b5e5;
  35. color: #ffffff;
  36. box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  37. }
  38. .menu li:hover {
  39. background-color: #0099cc;
  40. }
  41. .aside {
  42. background-color: #33b5e5;
  43. padding: 15px;
  44. color: #ffffff;
  45. text-align: center;
  46. font-size: 14px;
  47. box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  48. }
  49. .footer {
  50. background-color: #0099cc;
  51. color: #ffffff;
  52. text-align: center;
  53. font-size: 12px;
  54. padding: 15px;
  55. }
  56. /* For desktop: */
  57. .col-1 {width: 8.33%;}
  58. .col-2 {width: 16.66%;}
  59. .col-3 {width: 25%;}
  60. .col-4 {width: 33.33%;}
  61. .col-5 {width: 41.66%;}
  62. .col-6 {width: 50%;}
  63. .col-7 {width: 58.33%;}
  64. .col-8 {width: 66.66%;}
  65. .col-9 {width: 75%;}
  66. .col-10 {width: 83.33%;}
  67. .col-11 {width: 91.66%;}
  68. .col-12 {width: 100%;}
  69.  
  70. @media only screen and (max-width: 768px) {
  71. /* For mobile phones: */
  72. [class*="col-"] {
  73. width: 100%;
  74. }
  75. }
  76. </style>
  77. </head>
  78. <body>
  79.  
  80. <div class="header">
  81. <h1>Chania</h1>
  82. </div>
  83.  
  84. <div class="row">
  85.  
  86. <div class="col-3 menu">
  87. <ul>
  88. <li>The Flight</li>
  89. <li>The City</li>
  90. <li>The Island</li>
  91. <li>The Food</li>
  92. </ul>
  93. </div>
  94.  
  95. <div class="col-6">
  96. <h1>The City</h1>
  97. <p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p>
  98. </div>
  99.  
  100. <div class="col-3 right">
  101. <div class="aside">
  102. <h2>What?</h2>
  103. <p>Chania is a city on the island of Crete.</p>
  104. <h2>Where?</h2>
  105. <p>Crete is a Greek island in the Mediterranean Sea.</p>
  106. <h2>How?</h2>
  107. <p>You can reach Chania airport from all over Europe.</p>
  108. </div>
  109. </div>
  110.  
  111. </div>
  112.  
  113. <div class="footer">
  114. <p>Resize the browser window to see how the content respond to the resizing.</p>
  115. </div>
  116.  
  117. </body>
  118. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement