Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Centered Tiles

Tags:

html

css

I'd like to design a horizontal line of tiles. Ideally I'd like something like this:

http://jsfiddle.net/GolezTrol/BDb5K/ found in another post by GolezTrol.

But centered. I have a lot of trouble centering elements, and these have been no exception. What is the best way to center (and space out) a structure like this?

EDIT: this is what I want - https://i.sstatic.net/7KWWI.png

like image 413
muttley91 Avatar asked Feb 22 '26 03:02

muttley91


1 Answers

One way would be to give the #container element a fixed width and then apply this style:

margin: 0 auto;

That will work for horizontal alignment, if you're after vertical alignment as well take a look at this page which has a working example for most (if not all) browsers.

like image 98
Clive Avatar answered Feb 23 '26 15:02

Clive



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!