I am totally new to CSS, but I am learning. I was searching how to center on CSS but you can only align top or left, right, or set a value like -50px. How can I make an image to center? Imagine there is an image in a screenshot. http://www.ipix.lt/desc/49464521
OK, I am making an image archive type blog. It is made out of dynamic tiles. The problem is that images have different aspect ratio, so to align them well I have to make fixed size of each tile. If image is wide it leaves a big white gap. Centering it would make that space smaller, since it would be shared on top and bottom. I am attaching a better screenshot. http://www.ipix.lt/desc/31035498/
Yes, exactly! But the size of each tile is variable and there is a a lot of code. (I am editing code on tumblr, if this makes any difference) What should I change?
Try using vertical-align: middle on the elements you want to center vertically. Notice that the container should have a line-height equal to its height for this trick to work. vertical-align does not work for block elements so you can't center both your image and those buttons. I suggest you to keep those buttons on top and below your header while you center your image using vertical-align. here's an example I made: http://jsbin.com/omapi4/3/edit (click preview to see the results)
How can I make an image to center? Imagine there is an image in a screenshot.
http://www.ipix.lt/desc/49464521
Looking at the screenshot you posted I'm not really sure what you're trying to achieve.
http://www.ipix.lt/desc/31035498/
Usually it's something like this
But the size of each tile is variable and there is a a lot of code.
(I am editing code on tumblr, if this makes any difference)
What should I change?
Another solution would be using javascript =)