Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在没有css定位的情况下,如何设置背景图像以适应屏幕大小?_Css_Image - Fatal编程技术网

在没有css定位的情况下,如何设置背景图像以适应屏幕大小?

在没有css定位的情况下,如何设置背景图像以适应屏幕大小?,css,image,Css,Image,在没有css定位的情况下,如何设置背景图像以适应屏幕大小?我在做作业,我想设置一个背景图像,但我的教授说我不能使用定位,所以有其他方法吗?试试这个 html{ background:url('backgroundimage.jpg') no-repeat center center; min-height:100%; min-width:100%; background-size:cover; } body{ min-height:100%;/*hac

在没有css定位的情况下,如何设置背景图像以适应屏幕大小?我在做作业,我想设置一个背景图像,但我的教授说我不能使用定位,所以有其他方法吗?

试试这个

html{
    background:url('backgroundimage.jpg') no-repeat center center;
    min-height:100%;
    min-width:100%;
    background-size:cover;
}

body{

    min-height:100%;/*hack for some mobile browsers */
    min-width:100%;
}

您可以使用背景定位吗?这是一个奇怪的限制。有人问:不,我不能使用任何包含单词positioncss属性left、right、margin、padding的内容,因为它们中没有单词“position”。。!!!