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.

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.