跨浏览器兼容性-必应壁纸网页抓取



我试图在这里显示必应主页
它是一个网页抓取器,查找图像URL并设置它作为背景图像。
但是像往常一样,ie浏览器总是有问题。但我希望IE11能很好地处理它。然而,事实并非如此。我的目标是放大和缩小,背景图像不应该被调整大小。
在Google Chrome和Mozilla Firefox上一切正常。
我想试着做到在所有浏览器上看起来都一样。我应该/能做什么?

下面是我的代码:

echo '<!DOCTYPE html>';
echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>';
echo '<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />';
echo "<title>Bing Wallpaper Scraper</title>";
$style="body {
background-image: url('$v');
-moz-background-size: cover;
-o-background-size: cover;
-webkit-background-size: cover;
background-size: cover;
background-position: top center !important;
background-repeat: no-repeat !important;
background-attachment: fixed;
}";
echo "<style>$style</style>";
echo "</head>";
echo "<body>";//background='$v'
echo "<div style='text-align:center;'>";
echo "<h1 style='color:white'> I did it! </h1>";
echo "<h2 style='color:white'> You too can! </h2>";
echo "</div>";
echo "</body></html>";

变量$v包含来自web scraper的图像URL。

去掉background-attachment属性,你就会得到你想要的了

最新更新