简体   繁体   English

将div中的div推到与IE7兼容的最底端

[英]Pushing a div inside a div to the very bottom that works with IE7

I'm running in to a slight problem where I am not able to align and get the same effect I get from chrome in IE7. 我遇到了一个小问题,即我无法对齐并无法获得与IE7中的chrome相同的效果。 What I am trying to accomplish is to push a div with a background to the bottom of a container div. 我要完成的工作是将具有背景的div推到容器div的底部。

JS Fiddle : http://jsfiddle.net/mn34r/ JS小提琴: http : //jsfiddle.net/mn34r/

Code

<div class="container">
  <img style="padding-top:20px; padding-bottom:20px" src="img/img.png">
  <div class="description"><br>
  <span style="font-weight:bold;font-size:15px;">Harry's Nose</span><br>

  <button class="btn btn-small btn-primary" type="button"><i style="color:#fff;
  </i>Read More</button>
 </div>
</div>

css: CSS:

.container{
    border:solid 1px #e2e2e2;
    height:327px;
    text-align:center;
    position:relative;
}

.description{
    height:110px;
    background-color:#F1F1F1;
    text-align:center;
    bottom:0;
    width:100%;
    position:absolute
}

Any help would be greatly appreciated. 任何帮助将不胜感激。

Thank you. 谢谢。

In IE7 top: overwrites bottom: , so you need to use an IE6/7 hack with CSS expressions. 在IE7 top:覆盖bottom: ,因此您需要对CSS表达式使用IE6 / 7技巧。

#forceBottom {
  position:absolute;
  top:expression(
     document.documentElement.scrollTop +  
     document.documentElement.clientHeight - 
     this.clientHeight
  );
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM