07-24-grid-layout-auto.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Grid layout using the auto algorithm</title>
  6. <!-- the base styles and "housekeeping" styles are in here: -->
  7. <link rel="stylesheet" href="css/grid-base.css">
  8. <!-- the HTML5 shiv, to help older browsers understand styling
  9. on newer HTML5 elements: -->
  10. <script src="js/html5shiv.min.js"></script>
  11. <style>
  12. /* content styling */
  13. .grid-a {
  14. display: -webkit-grid;
  15. display: grid;
  16. -webkit-grid-template-rows: auto auto auto;
  17. grid-template-rows: auto auto auto;
  18. -webkit-grid-template-columns: repeat(5, 1fr);
  19. grid-template-columns: repeat(5, 1fr);
  20. margin: 0 -.6875em;
  21. }
  22. .subcategory {
  23. margin-top: 1.5em;
  24. border-bottom: 1px solid #8e3339;
  25. }
  26. .subcategory-header {
  27. padding: .6875em;
  28. -webkit-grid-row: 1/-1;
  29. grid-row: 1/-1;
  30. }
  31. .story-featured {
  32. -webkit-grid-column: span 2;
  33. grid-column: span 2;
  34. }
  35. .story {
  36. padding: .6875em;
  37. margin: 0 .6875em 1.375em;
  38. background-color: #eee;
  39. }
  40. .story img {
  41. max-width: 100%;
  42. }
  43. </style>
  44. </head>
  45. <body>
  46. <header class="masthead">
  47. <div class="wrapper">
  48. <h1>Important News</h1>
  49. </div>
  50. </header>
  51. <nav role="navigation" class="navbar">
  52. <div class="wrapper">
  53. <ul class="navlist">
  54. <li><a href="#">Home</a></li>
  55. <li><a href="#">World</a></li>
  56. <li><a href="#">Local</a></li>
  57. <li><a href="#">Sports</a></li>
  58. </ul>
  59. </div>
  60. </nav>
  61. <main class="wrapper">
  62. <section class="subcategory">
  63. <div class="grid-a">
  64. <header class="subcategory-header">
  65. <h2>Lorem ipsum</h2>
  66. </header>
  67. <article class="story story-featured">
  68. <img src="http://placehold.it/600x300" alt="Dummy image">
  69. <h3><a href="#">Cras suscipit nec leo id.</a></h3>
  70. <p>Autem repudiandae aliquid tempora quos reprehenderit architecto, sequi repellat.</p>
  71. </article>
  72. <article class="story">
  73. <img src="http://placehold.it/600x300" alt="Dummy image">
  74. <h3><a href="#">Perferendis, ipsam!</a></h3>
  75. <p>Neque magnam vero obcaecati facere nobis sint dolore accusamus vitae consequuntur ad necessitatibus, laborum molestiae.</p>
  76. </article>
  77. <article class="story">
  78. <img src="http://placehold.it/600x300" alt="Dummy image">
  79. <h3><a href="#">Curabitur mattis purus nec velit.</a></h3>
  80. <p>Neque magnam vero obcaecati facere nobis sint dolore accusamus vitae consequuntur ad necessitatibus, laborum molestiae.</p>
  81. </article>
  82. <article class="story">
  83. <h3><a href="#">Perferendis, ipsam!</a></h3>
  84. </article>
  85. <article class="story">
  86. <h3><a href="#">Aliquam mattis eros id posuere.</a></h3>
  87. </article>
  88. <article class="story">
  89. <h3><a href="#">Proin leo felis, semper nec</a></h3>
  90. </article>
  91. <article class="story">
  92. <h3><a href="#">Aliquam vitae risus tortor. Sed!</a></h3>
  93. </article>
  94. <article class="story">
  95. <h3><a href="#">Perferendis, ipsam!</a></h3>
  96. </article>
  97. <article class="story">
  98. <h3><a href="#">Aliquam mattis eros id posuere.</a></h3>
  99. </article>
  100. <article class="story">
  101. <h3><a href="#">Proin leo felis, semper nec</a></h3>
  102. </article>
  103. <article class="story">
  104. <h3><a href="#">Aliquam vitae risus tortor. Sed!</a></h3>
  105. </article>
  106. </div>
  107. </section>
  108. </main>
  109. </body>
  110. </html>