Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Basic PHP Website Listing and Sorting Inventory Items Displaying All Items

Josh Divis
seal-mask
.a{fill-rule:evenodd;}techdegree
Josh Divis
Full Stack JavaScript Techdegree Student 8,672 Points

Style is different than video

I haven't changed any of the CSS or the link to the file but mine shows each element on their own individual lines. Why isn't it styled to be on a 4x4 grid like Alena says and shows hers to be?

include ("inc/data.php");
$pageTitle = "Full Catalog";
$section = null;

if (isset($_GET["cat"])) {
    if ($_GET["cat"] == "books") {
        $pageTitle = "Books";
        $section = "books";
    } elseif ($_GET["cat"] == "movies"){
        $pageTitle = "Movies";
        $section = "movies";
    }elseif ($_GET["cat"]== "music"){
        $pageTitle = "Music";
        $section = "music";
}
}
include("inc/header.php"); ?>

<div class="section catalog page">
    <div class = "wrapper">
        <h1><?php echo $pageTitle; ?></h1>

        <ul class="items">
            <?php 
            foreach ($catalog as $item) {
                echo "<li<a href='#'><img src='" 
                . $item["img"] . "'alt ='" 
                . $item["title"] . "' />" 
                . "<p> View Details</p>"
                . "</a></li>";
            }
            ?>
        </ul>
    </div>
</div>

<?php include("inc/footer.php"); ?>

I have same query..

1 Answer

John Plastow
John Plastow
9,284 Points

Josh Divis You're missing the > on your opening <li> tag on line 26. I'm betting that's the cause of your grid issue. And although I doubt this is contributing to your issue, you've got a space between the alt attribute and its =. The space should be before alt instead. Also, you've got an extra space before "View" that could throw off your spacing by a few pixels.