无法居中图像

McL*_*ive 2 html css center

我无法将图像置于中心位置div.如何在给定以下标记的情况下居中图像?

html代码如下:

<div id='post-area' style='background:#000; padding:20px 0;'>
  <a class='fancybox' rel='group' href='example-big.png'>
    <img src='example.png'  />
  </a>
</div>
Run Code Online (Sandbox Code Playgroud)

css代码如下:

#post-area {
  font-size:13px;
  color:#000;
  text-align:left;
  width:450px;
  height:auto;
  font-family:Meera
  clear:both;
  margin-top:20px;
  letter-spacing:normal;
}

#post-area img {
  max-width:250px;
  height:auto;
  float:none;
  margin:0 auto;
}
Run Code Online (Sandbox Code Playgroud)

如果有任何办法可以做到这一点

小智 8

如果您只想水平居中图像,可以将text-align:left更改为text-align:center.