07-27-grid-layout-template.html 3.1 KB

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