views:

49

answers:

2

I want to end up with:

Hello there!

      <image>
      This is an image

Hi!

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.

A: 

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
</div>

Hi !

#container {
    height:100px;
    line-height:100px;
}

#container img {
    vertical-align:middle;
    max-height:100%;
}
MatTheCat
Can I use Markdown syntax inside the `div`?
Chetan
I think Markdown is not used for positionning
MatTheCat
Oh, I was looking for horizontal centering.
Chetan
A: 

I figured that I'd just have to use HTML where I want to horizontally align anything.

So my code would look like this:

Hello there!

      <center><img src="" ...></center>
      <center>This is an image</center>

Hi!
Chetan
The `<center>` element is **deprecated** in HTML4 since 1998. Just use CSS to make it or its wrapper a block element with a fixed width and `margin: 0 auto;` on it.
BalusC