js代码代替这个位移transform: translate(-50%,-50%)兼容ie8以下
想用js代码代替这个位移,这是CSS3的属性,IE8及以下不兼容<!doctypehtml><html><head><metacharset="utf-8"><title...
想用js代码代替这个位移,这是CSS3的属性,IE8及以下不兼容
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
body{margin:0; padding:0;text-decoration: none; font-family: "微软雅黑"; font-size:0; overflow-y: auto;width:100%; overflow-x: hidden;}
#img{position:relative; height:465px; width:100%;}
#img img{position: absolute;top: 50%;left: 50%; width:auto;
-ms-transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
-o-transform: translate(-50%,-50%);
transform: translate(-50%,-50%); height:100%;}
</style>
</head>
<body>
<div id="img"><img src="tou.png"></div>
</body>
</html>
transform: translate(x,y) 这个位移IE8及以下不兼容,求怎么用js代替 展开
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
body{margin:0; padding:0;text-decoration: none; font-family: "微软雅黑"; font-size:0; overflow-y: auto;width:100%; overflow-x: hidden;}
#img{position:relative; height:465px; width:100%;}
#img img{position: absolute;top: 50%;left: 50%; width:auto;
-ms-transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
-o-transform: translate(-50%,-50%);
transform: translate(-50%,-50%); height:100%;}
</style>
</head>
<body>
<div id="img"><img src="tou.png"></div>
</body>
</html>
transform: translate(x,y) 这个位移IE8及以下不兼容,求怎么用js代替 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询