锚内部的垂直对齐图像

问题描述

| 我有两列的
<ul>
码:
<li class=\"clearfix\">
<div class=\"product-copy\">
 Product Content Here
</div>
<a href=\"\">
    \"PRODUCT IMAGE HERE\"
</a>
</li>
.product-copy
扩展为高度内容,宽度固定。 我希望能够将锚点内的图像垂直对齐到中心。因此,无论ѭ2的高度有多大,右栏中的图像始终会居中。 请注意,我仍然是新用户,因此无法在锚点中键入正确的图像html,但是锚点中有html图像。 有任何想法吗? 谢谢     

解决方法

        您可以尝试一些CSS,例如
.product_img { position:absolute; top:0; bottom:0; }
这是从内存中,您可能需要删除position:absolute;从课堂上。 只需将类添加到img标签,这将使您的图像垂直对齐到div的中间。
<img srv=\"my_image.png\" class=\"product_image\" />
我希望这有帮助 :)