兼容IE6 7 8 chrome firefox图片水平垂直居中
2014-03-17 11:34
337 查看
工作中用到做笔记,table-layout: fixed;解决IE8下左右边距变大,Google到的解决办法
http://bytes.com/topic/html-css/answers/870359-ie8-display-table-cell-max-width-bug
http://bytes.com/topic/html-css/answers/870359-ie8-display-table-cell-max-width-bug
<div class="item"><p><img src="http://www.kddev.com/upload/member/22/22_4a37c7c814fbe57010db5b619a92d414.jpg_240x240.jpg"></p></div>
/*图片列表 兼容IE6水平垂直居中*/ /*For Firefox Chrome*/ .photo-list .item{float: left;cursor: pointer;border:1px #eee solid;width:100px;height:100px;table-layout: fixed;overflow:hidden;text-align:center;display:table;float:left;margin-left:20px; margin-top: 20px;position:relative;} .photo-list .item p{display:table-cell;vertical-align:middle;width:100px;height:100px;} .photo-list .item img{margin:0 auto;max-width:100px;max-height:100px;} /*For IE7*/ *+html .photo-list p{position:absolute;top:50%;width:auto;text-align:center;height:auto;} *+html .photo-list p img{position:relative;top:-50%;left:-50%;} /*For IE6*/ *html .photo-list p{position:absolute;top:51%;width:100%;text-align:center;height:auto;display:block;} *html .photo-list p img{position:relative;top:-50%;left:-50%;width:expression(this.width>100?"100px":"auto");height:expression(this.height>100?"100px":"auto");}
相关文章推荐
- Xcode磁盘空间大清理
- 关于QGis编译
- xmemcached与spring结合使用时连接超时问题解决方法(转)
- 在数组中查找某一指定数组元素
- AAA authenticaiton on Cisco device
- Android回顾之数据存储
- 我见过的关于notify()和notifyAll()区别的最简洁的代码
- nginx gzip duplicate MIME type “text/html”
- Android高效加载大图多图并有效避免程序OOM
- 内部排序之五:计数排序、基数排序和桶排序
- HTML通过事件传递参数到js
- 使用div+css布局过程中在什么时候使用table呢
- yum出错Error: Cannot find a valid baseurl for repo: base
- yum出错Error: Cannot find a valid baseurl for repo: base
- 宣布正式发布 Windows Azure 上的 Oracle 软件以及 Windows Azure Traffic Manager 更新
- 宣布正式发布 Windows Azure 上的 Oracle 软件以及 Windows Azure Traffic Manager 更新
- 宣布正式发布 Windows Azure 上的 Oracle 软件以及 Windows Azure Traffic Manager 更新
- 通过实验窥探javascript的解析执行顺序
- mysql的from_unixtime函数
- 宣布正式发布 Windows Azure 上的 Oracle 软件以及 Windows Azure Traffic Manager 更新