惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
小众软件
小众软件
GbyAI
GbyAI
B
Blog RSS Feed
月光博客
月光博客
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
博客园_首页
G
Google Developers Blog

博客园 - flykye

FLEX内存优化技巧集合 在FF下用CSS模拟实现text-overflow:ellipsis字符截取省略号效果 - flykye - 博客园 FireBug的控制台管理 推介的CSS书写顺序(转) JavaScript与ActionScript通讯 JavaScript继承之闭包原型继承法 JavaScript在内层循环中断外层循环 我的Blog不含三聚氰胺 傲游越来越差了 IE下LI的3pxBUG IE下使用CSS截取文字 调试JavaScript,不再用alert了 (二) 调试JavaScript,不再用alert了 firefox的css私有属性 scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解 页面优化技巧 javascript拖动小例子 Firefox下的__proto__ IE7 IE6 FF 简单的CSS Hack
CSS实现未知高度图文混合垂直居中
flykye · 2008-10-05 · via 博客园 - flykye

IE6,IE7,FF3测试通过

CSS
* {
margin
:0;
padding
:0;
list-style
:none;
}

#vertical_box

{
width
:100%;
display
:table;
border
:1px red solid;
height
:400px;
 /*针对IE的hack*/
*position
:relative;
}

#vertical_box_sub

{
display
: table-cell;
vertical-align
: middle;
 /*针对IE的hack*/
*position
:absolute;
*top
:50%;
}

#vertical_box_container

{
font-family
:"宋体";
border
:1px green solid;
/*针对IE的hack*/
*position
:relative;
*top
:-50%;

margin
:0 auto;
width
:200px;
}
HTML
<div id="vertical_box">
<div id="vertical_box_sub">
<div id="vertical_box_container">
<p>我是居中的文字</p>
<p>我居中</p>
<p>你也居中</p>
<img src="http://www.adobetutorialz.com/Advertising/W3Markup.jpg" border=0 alt="" title="">
</div>
</div>
</div>