2011-09-21 45 views
0

正在使用html,css来显示图像。使用css,html在iphone webview屏幕中心显示图像

IMG.displayed { 
    display: block; 
    margin-left: auto; 
    margin-right: auto; 
    vertical-align: middle 
} 
<IMG class="displayed" src="../images/splash.png" alt="..."> 
</IMG> 

它不是在屏幕的中心显示图像(既垂直& horozontally)。

您的建议请。

回答

1

要对齐的元素同时在垂直&水平,你可以使用下面的代码片段:

http://jsfiddle.net/catalinred/huKYW/

HTML:

 
<div>content here</div> 

CSS

 
div 
{ 
    width: 300px; 
    height: 300px; 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    margin-left: -150px; 
    margin-top: -150px; 
    background: red; 
} 
+0

谢谢。该页面已关闭。你可以发布代码片段吗? – yokks