I'm currently developing a website for an online shopping cart and working on making the search results responsive. I am aiming to display as many items as possible across the screen (usually 3) when viewed on any device with a resolution lower than that of a desktop. Furthermore, I want these items to be centered, even on a phone.
However, I am facing a challenge where I can't seem to make the parent div match the width of its children, let alone center it.
I have experimented with using display: inline-block
, which does give dimensions to the div, but unfortunately, it ends up taking up 100% of the width.
For a visual representation of my issue, you can view an example here: http://jsfiddle.net/0jnjum30/1/
Has anyone encountered a similar situation before? Ideally, I would prefer to solve this problem using CSS only.