07-29-grid-layout-template-more-ads.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Grid layout with template areas – adding more ads</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-b {
  14. display: -webkit-grid;
  15. display: grid;
  16. -webkit-grid-template-columns: 20% 1fr 1fr 1fr;
  17. grid-template-columns: 20% 1fr 1fr 1fr;
  18. -webkit-grid-template-areas: "hd ... ... ..."
  19. "hd st1 ... st2"
  20. "hd ... ... ...";
  21. grid-template-areas: "hd ... ... ..."
  22. "hd st1 ... st2"
  23. "hd ... ... ...";
  24. margin: 0 -.6875em;
  25. }
  26. .subcategory {
  27. margin-top: 1.5em;
  28. border-bottom: 1px solid #8e3339;
  29. }
  30. .grid-b .subcategory-header {
  31. padding: .6875em;
  32. -webkit-grid-area: hd;
  33. grid-area: hd;
  34. }
  35. .story {
  36. padding: .6875em;
  37. margin: 0 .6875em 1.375em;
  38. background-color: #eee;
  39. -webkit-grid-template-columns: span 1;
  40. grid-template-columns: span 1;
  41. }
  42. .grid-b .story:nth-child(2) {
  43. -webkit-grid-area: st1;
  44. grid-area: st1;
  45. }
  46. .grid-b .story:nth-child(3) {
  47. -webkit-grid-area: st2;
  48. grid-area: st2;
  49. }
  50. .story-featured {
  51. -webkit-grid-area: a;
  52. grid-area: a;
  53. }
  54. .story img {
  55. width: 100%;
  56. }
  57. .ad {
  58. padding: .6875em;
  59. margin: 0 .6875em 1.375em;
  60. display: -webkit-flex;
  61. display: -ms-flexbox;
  62. display: flex;
  63. background-color: #8e3339;
  64. color: #fff;
  65. }
  66. .ad h3 {
  67. margin: auto;
  68. }
  69. .ad h3 a {
  70. color: inherit;
  71. }
  72. </style>
  73. </head>
  74. <body>
  75. <header class="masthead">
  76. <div class="wrapper">
  77. <h1>Important News</h1>
  78. </div>
  79. </header>
  80. <nav role="navigation" class="navbar">
  81. <div class="wrapper">
  82. <ul class="navlist">
  83. <li><a href="#">Home</a></li>
  84. <li><a href="#">World</a></li>
  85. <li><a href="#">Local</a></li>
  86. <li><a href="#">Sports</a></li>
  87. </ul>
  88. </div>
  89. </nav>
  90. <main class="wrapper">
  91. <section class="subcategory row">
  92. <div class="grid-b">
  93. <header class="subcategory-header">
  94. <h2>Dolor sit amet</h2>
  95. </header>
  96. <article class="story">
  97. <img src="http://placehold.it/600x300" alt="Dummy image">
  98. <h3><a href="#">Ut sit amet mi massa</a></h3>
  99. <p>Neque magnam vero obcaecati facere nobis sint dolore accusamus vitae consequuntur ad necessitatibus, laborum molestiae.</p>
  100. </article>
  101. <article class="story">
  102. <img src="http://placehold.it/600x300" alt="Dummy image">
  103. <h3><a href="#">Animi, explicabo, ipsum</a></h3>
  104. <p>Neque magnam vero obcaecati facere nobis sint dolore accusamus vitae consequuntur ad necessitatibus, laborum molestiae.</p>
  105. </article>
  106. <div class="ad">
  107. <h3><a href="#">Buy more stuff!</a></h3>
  108. </div>
  109. <div class="ad">
  110. <h3><a href="#">Buy other stuff!</a></h3>
  111. </div>
  112. <div class="ad">
  113. <h3><a href="#">Buy more stuff!</a></h3>
  114. </div>
  115. <div class="ad">
  116. <h3><a href="#">Buy other stuff!</a></h3>
  117. </div>
  118. <div class="ad">
  119. <h3><a href="#">Buy more stuff!</a></h3>
  120. </div>
  121. <div class="ad">
  122. <h3><a href="#">Buy other stuff!</a></h3>
  123. </div>
  124. <div class="ad">
  125. <h3><a href="#">Buy other stuff!</a></h3>
  126. </div>
  127. </div>
  128. </section>
  129. </main>
  130. </body>
  131. </html>