Centering (horizontally and vertically) an image in a box

in Blog This article was originally published by Julian Gude on The Remarkable Blog from
<div class="posterous_bookmarklet_entry">
  <blockquote class="posterous_long_quote"><h1>Centering (horizontally and vertically) an image in a box</h1>

The problem

We want to center an image inside a container, bigger than the image and with assigned dimensions. The image is not a background one, it’s a true <img> element.

Any image has well defined dimensions, so the easiest and most reliable way to solve the problem is:

<p>If you work on websites then you come across some interesting challenges when formatting images in different sizes. I found this instructional article on (Italian) quite helpful. The url to was left like a breadcrumb in the css of the WordPress NextGen Gallery plugin (well done Alex!). 


Via Alex Rabe WordPress NextGen Gallery Plugin

Comments are closed.