试图让背景图像适合

时间:2018-04-14 00:26:05

标签: css

我试图让我的背景图像适合屏幕而不拉伸它。 每当我的网站显示时,我的图像就会旋转。

非常感谢任何帮助。

body {
height: 100%;
margin: 0; 
padding: 0;
}

背景图片代码。

#page-background {
height: 100%;
left: 0;
position: fixed; 
top: 0;   
width: 100%;
}

要旋转的背景图片的代码..

<div id="page-background">
<?php
//Add as many links you want
$mylink[1] = '<img src="http://www.zarias.com/wp-content/uploads/2015/12/61-cute-puppies.jpg" width="100%" height="100%">
<div id="download">
<a href="images/more.png" title="Download this image. Use of this image is restricted to wallpaper only"download>* Download This Image *</a>
</div>';
// this will count your links itself and select a random one
$id = rand(1,count($mylink));
// this will display the random link
echo $mylink[$id];
?>
</div>

1 个答案:

答案 0 :(得分:0)

为什么不尝试使用视口?您可以根据浏览器设置图像大小。 viewports