Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to centre row content? #179

Open
hoohum opened this issue Jan 14, 2017 · 1 comment
Open

How to centre row content? #179

hoohum opened this issue Jan 14, 2017 · 1 comment

Comments

@hoohum
Copy link

hoohum commented Jan 14, 2017

I have a php mysql site which has an admin page showing three drop downs. In each of the drop downs a product can be selected from a list. Once the admin page is saved, those 3 products are displayed on the home page in a 'featured products' row. The code to display them is set using the class 4u. So perfect, 3 product photos show side by side, or underneath each other on smartphones.

Only problem is, the administrator can just select two products and leave one blank. So the resulting display is two thumbnails aligned left on the page with a gap on the right.

I would like to centre the display if only one or two products are selected to make even gaps either side. I cannot do that.

Can the contents of a row with cells set with 4u class, be centre aligned somehow, or can some code be written that intelligently assigns 12u if one product is presented, 6u if two are presented and 4u if three are presented?

@morvy
Copy link

morvy commented Jan 24, 2017

you can use offsets, so you need to calculate, if 3 items, offset 0, if 2 items, offset 2, if 1 item, offset 4 ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants