繁体   English   中英

图像显示在某些设备上发生变化

[英]Image display alters on some devices

我正在开发位于此处的移动应用程序。 其中有一个名为“ APP DOWNLOADS”的链接,该链接只能在ios和android上看到。

现在,在iPad上查看此页面时,应用程序图像看起来不错,但是在我的galaxy s3上查看此页面时,应用程序图像看起来不太好。 它全都伸展而又薄。

该页面通过以下代码显示图像:

<img src="<?php echo $article['app_img']; ?>" class="appimg" border="0" border="0" align="left"
.appimg {border-radius: 30px;
  -moz-border-radius: 30px;
  -webkit-border-radius: 30px;
    width:150px;    
    height:150px;
    position:relative; 
    background-color: transparent; }

但是浏览器显然显示不同。

有人可以为我提供解决方案吗?

可用的屏幕截图:

iPad iPhone 安卓

以上所有3个视图均使用相同的代码,但分别在android上显示图像。

请帮忙谢谢。

即使我在xclo.mobi上也遇到了同样的问题。

然后,我使站点成为动态站点,我的css基于当前设备是动态站点。

因此,请尝试获取当前设备并在客户端浏览器上相应地加载CSS内容。

逻辑:如果当前设备== ipad加载CSS {width:150px}

这是因为浏览器和设备的分辨率。

我希望下面的代码能对您有所帮助。

 <?php


/* detect mobile device*/
$ismobile = 0;
$container = $_SERVER['HTTP_USER_AGENT'];

// A list of mobile devices change as you wish
$useragents = array ( 

'Blazer' ,
'Palm' ,
'Handspring' ,
'Nokia' ,
'Kyocera',
'Samsung' ,
'Motorola' ,
'Smartphone', 
'Windows CE' ,
'Blackberry' ,
'WAP' ,
'SonyEricsson',
'PlayStation Portable', 
'LG', 
'MMP',
'OPWV',
'Symbian',
'EPOC',

); 

foreach ( $useragents as $useragents ) { 
if(strstr($container,$useragents)) {
$ismobile = 1;
} 
}
//And then you can load your css 
//eg:==
if($ismobile=1)
echo '.appimg{width:250px;height:250px}';//Change for device as you want
//After your php statements you can load your site content as usual

希望这对您有帮助

使用此代码对其进行排序

.appimg {
border-radius: 30px;
  -moz-border-radius: 30px;
  -webkit-border-radius: 30px;
    width:150px;    
    height:150px;
    position:relative; 
    background-color: transparent;
}

@media only screen and (-webkit-device-pixel-ratio:.75){
.appimg { 
 border-radius: 20px;
  -moz-border-radius: 20px;
  -webkit-border-radius: 20px; 
    width:150px;    
    height:350px;
    position:relative;
    background-color: transparent;
}
}

请1up谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM