pusatdata

Kode 2 Kolom Responsif

Nov 26th, 2022
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1">
  5. <style>
  6. * {
  7. box-sizing: border-box;
  8. }
  9.  
  10. /* Create two equal columns that floats next to each other */
  11. .column {
  12. float: left;
  13. width: 50%;
  14. padding: 10px;
  15. height: 300px; /* Should be removed. Only for demonstration */
  16. }
  17.  
  18. /* Clear floats after the columns */
  19. .row:after {
  20. content: "";
  21. display: table;
  22. clear: both;
  23. }
  24.  
  25. /* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
  26. @media screen and (max-width: 600px) {
  27. .column {
  28. width: 100%;
  29. }
  30. }
  31. </style>
  32. </head>
  33. <body>
  34.  
  35. <h2>Responsive Two Column Layout</h2>
  36. <p>Resize the browser window to see the responsive effect (the columns will stack on top of each other instead of floating next to each other, when the screen is less than 600px wide).</p>
  37.  
  38. <div class="row">
  39. <div class="column" style="background-color:#aaa;">
  40. <h2>Column 1</h2>
  41. <p>Some text..</p>
  42. </div>
  43. <div class="column" style="background-color:#bbb;">
  44. <h2>Column 2</h2>
  45. <p>Some text..</p>
  46. </div>
  47. </div>
  48.  
  49. </body>
  50. </html>
  51.  
Advertisement
Add Comment
Please, Sign In to add comment