0
4

3 回答 3

2

也许添加display: block;到两者aimg然后添加margin: 0px auto;到您的img.

于 2012-09-08T20:47:21.467 回答
2

首先,您需要使用 将 转换<a>为块元素display:block

Second, I would set your thumbnail as a background image instead and use background-position: center center which would cente rit vertically and horizontally

<a href="#" class="thumb" 
  style="background-image: url('@Url.Content( Path.Combine( "~/Uploads/Products/", @item.ImagePath ) )')">&nbsp;</a>
于 2012-09-08T20:49:13.123 回答
1

There are differences between HTML 4.01 and HTML5 in the tag. The layout attributes: align, border, hspace, and vspace were deprecated in HTML 4.01, and are not supported in HTML5! You have to wrap your tag in an other one and make your CSS do the align like this exemple:

<!DOCTYPE html>
<html>
<body>
  <article style="text-align:center">
    <img src="img/test.png" alt="test" />
  </article>
</body>
</html>
于 2012-09-08T21:11:56.430 回答