phpStudy
phpStudy
网站首页
软件下载
PHP教程
编程技术
PHP
MySQL
HTML
CSS
JavaScript
MSSQL
AJAX
.NET
JSP
window
Linux
Mac
ASP
服务器
CMS
SQL
jQuery
C#
C++
java
Android
IOS
oracle
MongoDB
PostgreSQL
SQLite
教程手册
php
html
html5
css
css3
JavaScript
ajax
jquery
sql
ado
asp
aspnet
browsers
careers
dhtml
dotnetmobile
dtd
e4x
glossary
hosting
htmldom
json
media
msnet
quality
rdf
rss
schema
semweb
site
sitemap
smil
soap
svg
tags
tcpip
vbscript
w3c
wap
web
webservices
wmlscript
wsdl
xforms
xhtml
xlink
xml
xmldom
xpath
xquery
xsl
xslfo
网站测速
小皮面板
智能dns
搜索
首页
PHP教程
未知长宽元素在已知300px*300px的容器中垂直居中(IE6/7/8/FF)
未知长宽元素在已知300px*300px的容器中垂直居中(IE6/7/8/FF)
加了很多HACK,顺便复习一下!
*+property:value; /* IE7 */
_property:value; /* IE6 */
*property:value; /*IE6、IE7 共用*/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>IE6/7/8/FF垂直居中</title> <style> * { margin:0; padding:0; } #out { display:table; background-color:#F00; width:300px; height:300px; _position:relative; overflow:hidden; } #mid { vertical-align:middle; display:table-cell; _position:absolute; _top:50%; -left:50%; } #in { _position:relative; _top:-50%; _left:-50%; text-align: center; } *+html #out { display:table; background-color:#F00; width:300px; height:300px; position:relative; overflow:hidden; } *+html #mid { vertical-align:middle; display:table-cell; position:absolute; top:50%; left:50%; } *+html #in { position:relative; top:-50%; left:-50%; text-align: center; } </style> </head> <body> <div class="container"> <div id="out"> <div id="mid"> <div id="in"> FF垂直居中FF直居中 FF垂直居中F直居中 FF垂直居中F直居中 FF垂直居中F直居中 </div> </div> </div> </body> </html>
提示:您可以先修改部分代码再运行
«
»
PHP教程
PHP简介
PHP基本语法
PHP类型
PHP变量
PHP运算符
PHP控制结构
PHP函数
PHP类与对象
PHP异常处理
函数库分类
快速导航
PHP
MySQL
HTML
CSS
JavaScript
MSSQL
AJAX
.NET
JSP
Linux
Mac
ASP
服务器
SQL
jQuery
C#
C++
java
Android
IOS
oracle
MongoDB
SQLite
wamp
交通频道
Copyright © 2016 phpStudy | 豫ICP备2021030365号-3