Color scheme

Editorial Grid and Responsive Card Grid

You have worked with named grid areas, auto-fit track generation, and the minmax pattern for responsive columns. This assignment puts both skills into practice on your portfolio. You will build two new pages: an editorial article layout driven by grid-template-areas, and a responsive card grid driven by auto-fit and minmax(). Each page gets its own local stylesheet alongside it. When you are done, both pages should be linked from your portfolio homepage.

Preparation

Create a new directory at unit-4/grid-layouts/ in your portfolio. Inside it you will create four files: two HTML pages and a local stylesheet for each. Both HTML pages link to your shared css/main.css for tokens and base styles, and to their own local stylesheet for the layout-specific CSS you write in this assignment.

The required live shared sheet is css/main.css. If you are keeping a bundler, follow After This Assignment: Stop or Keep.


        [portfolio]
        ├── unit-4/
        │   └── grid-layouts/
        │       ├── editorial.html      # New
        │       ├── editorial.css       # New
        │       ├── cards.html          # New
        │       └── cards.css           # New
        ├── index.html                      # Update: Add Links
        └── README.md                       # Update: Pages Links
    

Assignment Instructions

1. Build the Editorial Layout

Copy the HTML below into editorial.html. It represents a long-form article page with a header, navigation, main content area, a sidebar, and a footer. Do not modify the HTML structure or the class names on body, .layout, .byline, or .tags.


        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Editorial Layout</title>
            <link rel="stylesheet" href="../../css/main.css">
            <link rel="stylesheet" href="editorial.css">
        </head>
        <body class="editorial-page">

            <header>
                <a href="/">portfolio</a>
                <nav>
                    <a href="#">Home</a>
                    <a href="#">Articles</a>
                    <a href="#">About</a>
                </nav>
            </header>

            <div class="layout">

                <main>
                    <article>
                        <h1>The Art of Deliberate Practice</h1>
                        <p class="byline">By Alex Morgan &middot; June 2026</p>
                        <p>
                            Deliberate practice is not simply doing something repeatedly. It is a
                            structured form of improvement that requires focused attention, immediate
                            feedback, and consistent effort at the edge of your current ability.
                            Research across fields from music to athletics to software development
                            confirms that the quality of practice matters far more than the quantity.
                        </p>
                        <h2>What Makes Practice Deliberate</h2>
                        <p>
                            Three characteristics separate deliberate practice from mere repetition.
                            First, the activity must be designed to improve a specific aspect of
                            performance. Second, it must be performed with full concentration. Third,
                            it must include feedback so you can identify what to adjust.
                        </p>
                        <blockquote>
                            <p>
                                The difference between a master and a beginner is that the master
                                has failed more times than the beginner has tried.
                            </p>
                        </blockquote>
                        <h2>Applying It to CSS</h2>
                        <p>
                            For a CSS developer, deliberate practice means building layouts you
                            could not build last week, reading the spec when something surprises you,
                            and inspecting other sites with DevTools to understand decisions you
                            would not have made yourself. Passive reading and tutorial-following
                            produce familiarity. Deliberate practice produces skill.
                        </p>
                    </article>
                </main>

                <aside>
                    <section>
                        <h2>Related Articles</h2>
                        <ul>
                            <li><a href="#">Grid vs. Flexbox: A Practical Guide</a></li>
                            <li><a href="#">Writing CSS That Scales</a></li>
                            <li><a href="#">Debugging Layout Problems</a></li>
                        </ul>
                    </section>
                    <section>
                        <h2>Topics</h2>
                        <ul class="tags">
                            <li>CSS Grid</li>
                            <li>Layout</li>
                            <li>Practice</li>
                            <li>Performance</li>
                        </ul>
                    </section>
                </aside>

            </div>

            <footer>
                <p>&copy; 2026 portfolio. All rights reserved.</p>
            </footer>

        </body>
        </html>
    

In editorial.css, write the CSS to lay out .editorial-page .layout using grid-template-areas. Requirements:

  • On small screens, the main content and sidebar stack in a single column.
  • On wider screens (your choice of breakpoint), the layout switches to two columns with the sidebar on the right at a fixed width of your choosing.
  • Use grid-template-areas for the responsive switch. Area names, column definitions, gap, and all visual styling are your own design decisions using your existing token system.
  • The page header and footer sit outside .layout and are styled independently.

The nav inside the header contains links that should sit on one line. Think about whether that internal arrangement calls for Grid or Flexbox and be ready to explain your choice in the report.

2. Build the Responsive Card Grid

Copy the HTML below into cards.html. Do not modify the HTML structure or the class names on body, .card-grid, or .card.


        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Card Grid</title>
            <link rel="stylesheet" href="../../css/main.css">
            <link rel="stylesheet" href="cards.css">
        </head>
        <body class="articles-page">

            <header>
                <h1>Featured Articles</h1>
                <p>Exploring modern CSS layout techniques.</p>
            </header>

            <main>
                <div class="card-grid">

                    <article class="card">
                        <div aria-hidden="true"></div>
                        <div>
                            <h2>Named Grid Areas</h2>
                            <p>
                                Define your layout with readable area names instead of
                                column and row numbers.
                            </p>
                            <a href="#">Read more</a>
                        </div>
                    </article>

                    <article class="card">
                        <div aria-hidden="true"></div>
                        <div>
                            <h2>Responsive Tracks</h2>
                            <p>
                                Let the browser decide how many columns fit using
                                auto-fit and minmax.
                            </p>
                            <a href="#">Read more</a>
                        </div>
                    </article>

                    <article class="card">
                        <div aria-hidden="true"></div>
                        <div>
                            <h2>Flexbox Patterns</h2>
                            <p>
                                Use content-driven sizing when items should determine
                                their own width.
                            </p>
                            <a href="#">Read more</a>
                        </div>
                    </article>

                    <article class="card">
                        <div aria-hidden="true"></div>
                        <div>
                            <h2>Logical Properties</h2>
                            <p>
                                Write layouts that work naturally in both
                                left-to-right and right-to-left reading modes.
                            </p>
                            <a href="#">Read more</a>
                        </div>
                    </article>

                    <article class="card">
                        <div aria-hidden="true"></div>
                        <div>
                            <h2>Intrinsic Sizing</h2>
                            <p>
                                Use min-content, max-content, and fit-content()
                                to let content drive its own dimensions.
                            </p>
                            <a href="#">Read more</a>
                        </div>
                    </article>

                    <article class="card">
                        <div aria-hidden="true"></div>
                        <div>
                            <h2>Aspect Ratio</h2>
                            <p>
                                Control how images and media fill their containers
                                with aspect-ratio and object-fit.
                            </p>
                            <a href="#">Read more</a>
                        </div>
                    </article>

                </div>
            </main>

        </body>
        </html>
    

In cards.css, write the CSS to make .articles-page .card-grid a fully responsive card grid. Requirements:

  • Cards must be at least 240px wide and grow to fill available space equally.
  • The grid must never overflow its container at any viewport width. Use the min() safety pattern inside minmax().
  • Each .card must display its image placeholder and body content in a column arrangement. The first div in each card (the placeholder) should have a fixed height. All visual styling uses your existing token system.
  • The read-more link at the bottom of each card must be pushed to the bottom of the card regardless of how much text the card above it contains. Solve this with CSS only.

The last requirement means cards of different heights still need their links aligned at the bottom. There is more than one way to solve this. The approach you choose is worth reflecting on in your report.

3. Apply a Choose Topic (If Applicable)

If you studied one of the choose topics for this unit, apply at least one technique from it on either page:

  • Logical Properties: Replace all physical margin, padding, and border properties in your new CSS with their logical equivalents.
  • Intrinsic Sizing: Use min-content, max-content, or fit-content() as a track size or element width somewhere that benefits from content-driven sizing.
  • Aspect Ratio and Object Fit: Replace each card’s placeholder div with a real <img> and use aspect-ratio and object-fit: cover to make it fill its container cleanly.
  • display: contents: Find a place in either layout where removing a wrapper element from the formatting context with display: contents simplifies your grid structure.

If you did not study a choose topic, skip this step.

4. Update Your Homepage and README

Add links to editorial.html and cards.html on your portfolio homepage so they appear alongside your other completed assignments. Update your README.md under the Pages section with entries for both pages, following the same markdown list pattern from previous assignments.

5. Commit and Verify

Commit your work with a descriptive message, push to GitHub, and verify both pages load correctly on your live site. Check that the editorial layout switches at your chosen breakpoint and that the card grid reflows naturally as you resize the browser.

Submission

Complete the report below. When you are finished, download the PDF and submit it to Canvas.

Grid Layouts Report
Site Details

My live grid layouts pages are at and the source code is at .

Reflections
Layout Tool Decisions
You are building a product page for a client. It needs a hero, a three-column feature section, a full-width testimonial band, and a two-column spec comparison. Walk through which layout tool you would reach for in each section and why. You cannot use the same justification twice.
Responsive Areas
Your client comes back and says they want the editorial sidebar to move below the article on tablet but above it on mobile. What changes, and what stays the same? What does that tell you about how grid-template-areas distributes responsibility in a responsive layout?
Mentoring a Junior Developer
A junior developer on your team always reaches for auto-fill instead of auto-fit because it is simpler to remember one keyword. What advice would you give them?