07-XX-grid-layout-align-items.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. -webkit-align-items: start;
  22. align-items: start;
  23. }
  24. .subcategory {
  25. margin-top: 1.5em;
  26. border-bottom: 1px solid #8e3339;
  27. }
  28. .subcategory-header {
  29. padding: .6875em;
  30. -webkit-grid-row: 1/-1;
  31. grid-row: 1/-1;
  32. }
  33. .story-featured {
  34. -webkit-grid-column: span 2;
  35. grid-column: span 2;
  36. }
  37. .story {
  38. padding: .6875em;
  39. margin: 0 .6875em 1.375em;
  40. background-color: #eee;
  41. }
  42. .story img {
  43. width: 100%;
  44. }
  45. </style>
  46. </head>
  47. <body>
  48. <header class="masthead">
  49. <div class="wrapper">
  50. <h1>Important News</h1>
  51. </div>
  52. </header>
  53. <nav role="navigation" class="navbar">
  54. <div class="wrapper">
  55. <ul class="navlist">
  56. <li><a href="#">Home</a></li>
  57. <li><a href="#">World</a></li>
  58. <li><a href="#">Local</a></li>
  59. <li><a href="#">Sports</a></li>
  60. </ul>
  61. </div>
  62. </nav>
  63. <main class="wrapper">
  64. <section class="subcategory">
  65. <div class="grid-a">
  66. <header class="subcategory-header">
  67. <h2>Lorem ipsum</h2>
  68. </header>
  69. <article class="story story-featured">
  70. <img src="http://placehold.it/600x300" alt="Dummy image">
  71. <h3><a href="#">Cras suscipit nec leo id.</a></h3>
  72. <p>Autem repudiandae aliquid tempora quos reprehenderit architecto, sequi repellat.</p>
  73. </article>
  74. <article class="story">
  75. <img src="http://placehold.it/600x300" alt="Dummy image">
  76. <h3><a href="#">Perferendis, ipsam!</a></h3>
  77. <p>Neque magnam vero obcaecati facere nobis sint dolore accusamus vitae consequuntur ad necessitatibus, laborum molestiae.</p>
  78. </article>
  79. <article class="story">
  80. <img src="http://placehold.it/600x300" alt="Dummy image">
  81. <h3><a href="#">Curabitur mattis purus nec velit.</a></h3>
  82. <p>Neque magnam vero obcaecati facere nobis sint dolore accusamus vitae consequuntur ad necessitatibus, laborum molestiae.</p>
  83. </article>
  84. <article class="story">
  85. <h3><a href="#">Perferendis, ipsam!</a></h3>
  86. </article>
  87. <article class="story">
  88. <h3><a href="#">Aliquam mattis eros id posuere.</a></h3>
  89. </article>
  90. <article class="story">
  91. <h3><a href="#">Proin leo felis, semper nec</a></h3>
  92. </article>
  93. <article class="story">
  94. <h3><a href="#">Aliquam vitae risus tortor. Sed!</a></h3>
  95. </article>
  96. <article class="story">
  97. <h3><a href="#">Perferendis, ipsam!</a></h3>
  98. </article>
  99. <article class="story">
  100. <h3><a href="#">Aliquam mattis eros id posuere.</a></h3>
  101. </article>
  102. <article class="story">
  103. <h3><a href="#">Proin leo felis, semper nec</a></h3>
  104. </article>
  105. <article class="story">
  106. <h3><a href="#">Aliquam vitae risus tortor. Sed!</a></h3>
  107. </article>
  108. </div>
  109. </section>
  110. </main>
  111. </body>
  112. </html>