Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Listing Inventory Items Displaying All Products

Jeff Styles
Jeff Styles
2,784 Points

ul.products is not centered

All styles have applied accordingly (borders, hover, etc), except that the products grid is being pushed to the far left of the browser window. When I jump ahead and make ammendments from the next lesson this isn't an issue, but I'm confused as to why at the end of this current lesson, Randy's .products class is centered and mine is not. Thanks!

<?php foreach($products as $product) {?>
       <li>
         <a href="#">
            <img src="<?php echo $product["img"]; ?>" alt="<?php echo $product["name"];?>">
            <p>View Details</p>
         </a>
       </li> 
       <?php } ?>```

Please either post the code or a snapshot if you are working in Workspaces

Benjamin Payne
Benjamin Payne
8,142 Points

Centered in the center of the page or centered aligned? What do you have for your centered .css?

1 Answer

I believe that this is occurring, because you have forgotten to wrap your code with a div of a class of "wrapper" within the div with the classes of "section shirts page"

Thus ul.products should be a child of div.wrapper, which should be a child of div.section.shirts.page