Chetan Chetan - 1 year ago 133
CSS Question

Using Markdown, how do I center an image and its caption?

I want to end up with:

Hello there!

This is an image


Where the image and the text
This is an image
are centered on the page. How do I accomplish this with Markdown?

Edit: Note that I'm looking to horizontally center the image and text on the page.

Answer Source

You need a block container with a defined height, same value for line-height and image with vertical-align:middle; It should work.

Hello there !

<div id="container">
    <img />
    This is an image

Hi !

#container {

#container img {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download