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

CSS

Layout problem on a Product list Page - a button is in the wrong place. Help.

Hello, I'm working on this site right now. It's running on Magento. On the product list page, when having more than 4 products, it works with no issues (like here - http://www.fs1inc.com/catalogsearch/result/index/?cat=97&enginesize=210&q=5L8A-12A650-PC), but when the page has less than 4 products on it, the layout changes. Particularly, the "Add to Cart" button jumps on top of the products (like here http://www.fs1inc.com/catalogsearch/result/?q=5U7A-12650-KD).

I've figured that it has something to do with one/multiple rows situation, but I don't know what exactly is wrong since the code on both pages looks exactly the same. If anybody has an idea what it might be, please help.

4 Answers

Andrew Voitsekhovskyy
Andrew Voitsekhovskyy
3,523 Points

Hi , try to delete position: absolute here

.products-grid .actions {
    position: absolute;
    bottom: 12px;
}

I checked, on my computer it works in both cases))) let me know If it works, please

Hi Pavel You can add

.products-grid li.item {
position: relative;
}

It worked, Andrew, thanks. But why did the same setting work on the other page, though? "position: absolute" makes it work on the page with more than 4 products perfectly fine.

Andrew Voitsekhovskyy
Andrew Voitsekhovskyy
3,523 Points

I have no idea) This is a kind of magic:)

Alright, guys. It looks like the solution you provide fixes the problem for that particular page, but when applying that rule to other product list pages, it brakes the layout. Looks like it has something to do with the Magento template. Cause, I wasn't the one who put "position: absolute" there. And it worked correctly. Something is wrong, though. And more importantly, it affects only the "search result" pages. On a regular product list page, it looks alright, even if it has less than 4 products on it. Mistery.