css - 垂直对齐(对于 IE!)

标签 css z-index vertical-alignment css-tables

HTML:

<div class="product">
  <a href="#" class="thumb"><img src="img/thumb_md.png" alt="" /></a>
</div>

CSS:

.product .thumb {           
  position: relative;
  display: table-cell;
  vertical-align: bottom;
  height: 130px;
}

..在现代浏览器中运行良好,当然,IE 除外!

有解决办法吗?我尝试的另一个解决方案是 position:absolute;底部:0;但它会干扰上面的下拉菜单,其中 z-index 似乎没有任何效果。

谢谢!

最佳答案

是的,改用相对+绝对定位。其准系统是:

a.thumb { display: block; position: relative; height: 130px; }
a.thumb img { display: block; position: absolute; bottom: 0; }

参见 Absolute Positioning Inside Relative Positioning .

关于css - 垂直对齐(对于 IE!),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1483091/

相关文章:

html - 垂直对齐 float 图像 + 容器 (H+p)

javascript - 在 Javascript 中搜索表的多行和多列

javascript - getElementByID 输出到这里的是什么对象?

javascript - 在 Canvas 中将对象置于最前面

html - href 链接不可点击

html - div中输入字段的垂直和水平对齐方式

jquery - 文本在 div 下方偏移

html - 导航选项卡中的 Bootstrap 搜索栏

javascript - 如何做描边不透明度 :0 with d3

html - 位置为 : relative 的 CSS z-Index