Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.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
未在html中显示背景图像 .第1页{ 背景图像:url(../images/1.jpg); 背景尺寸:封面; 背景位置:中心; 宽度:100%; 身高:100%; 显示:块; 位置:相对位置; }_Html_Css - Fatal编程技术网

未在html中显示背景图像 .第1页{ 背景图像:url(../images/1.jpg); 背景尺寸:封面; 背景位置:中心; 宽度:100%; 身高:100%; 显示:块; 位置:相对位置; }

未在html中显示背景图像 .第1页{ 背景图像:url(../images/1.jpg); 背景尺寸:封面; 背景位置:中心; 宽度:100%; 身高:100%; 显示:块; 位置:相对位置; },html,css,Html,Css,这是我为网页设置背景图像的代码,但不幸的是它没有显示。有人能帮我更正此代码吗?可能您的html文档格式不正确 试试这个: <body> <div> <div class="page1"> </div> </body> .page1{ background-image:url(../images/1.jpg); background-size:cover; background-position:center; wid

这是我为网页设置背景图像的代码,但不幸的是它没有显示。有人能帮我更正此代码吗?

可能您的html文档格式不正确

试试这个:

<body>
<div>
    <div class="page1">
    </div> 
</body>
.page1{
background-image:url(../images/1.jpg);
background-size:cover;
background-position:center; 
width:100%;
height:100%;
display:block;
position:relative;
 }

.第1页{
背景图像:url(../images/1.jpg);
背景尺寸:封面;
背景位置:中心;
宽度:100%;
身高:100%;
显示:块;
位置:相对位置;
}


第二种可能是,您的图像没有正确链接。按照编写方式,它位于与html文档所持文件夹平行的“images”文件夹中。因此,找出文档和图像之间的相关性,并尝试修改它的源url(../images/1.jpg)

可能您的html文档格式不正确

试试这个:

<body>
<div>
    <div class="page1">
    </div> 
</body>
.page1{
background-image:url(../images/1.jpg);
background-size:cover;
background-position:center; 
width:100%;
height:100%;
display:block;
position:relative;
 }

.第1页{
背景图像:url(../images/1.jpg);
背景尺寸:封面;
背景位置:中心;
宽度:100%;
身高:100%;
显示:块;
位置:相对位置;
}


第二种可能是,您的图像没有正确链接。按照编写方式,它位于与html文档所持文件夹平行的“images”文件夹中。因此,找出文档和图像之间的相关性,并尝试修改它的源url(../images/1.jpg)

可能您的html文档格式不正确

试试这个:

<body>
<div>
    <div class="page1">
    </div> 
</body>
.page1{
background-image:url(../images/1.jpg);
background-size:cover;
background-position:center; 
width:100%;
height:100%;
display:block;
position:relative;
 }

.第1页{
背景图像:url(../images/1.jpg);
背景尺寸:封面;
背景位置:中心;
宽度:100%;
身高:100%;
显示:块;
位置:相对位置;
}


第二种可能是,您的图像没有正确链接。按照编写方式,它位于与html文档所持文件夹平行的“images”文件夹中。因此,找出文档和图像之间的相关性,并尝试修改它的源url(../images/1.jpg)

可能您的html文档格式不正确

试试这个:

<body>
<div>
    <div class="page1">
    </div> 
</body>
.page1{
background-image:url(../images/1.jpg);
background-size:cover;
background-position:center; 
width:100%;
height:100%;
display:block;
position:relative;
 }

.第1页{
背景图像:url(../images/1.jpg);
背景尺寸:封面;
背景位置:中心;
宽度:100%;
身高:100%;
显示:块;
位置:相对位置;
}


第二种可能是,您的图像没有正确链接。按照编写方式,它位于与html文档所持文件夹平行的“images”文件夹中。因此,找出文档和图像之间的相关性,并尝试修改它的源url(../images/1.jpg)

后台未显示,因为您的div需要内容。 2种选择: 您可以为body设置背景

<html>
<head>
<-- style block have to be contained within a <style> tag -->
<style>
    .page1{
        background-image:url(../images/1.jpg);
        background-size:cover;
        background-position:center; 
        width:100%;
        height:100%;
        display:block;
        position:relative;
     }
</style>
</head>
<body>
<div>
    <div class="page1">
    </div>
</div> <-- this tag was missing in your question -->
</body>

或者将div的高度设置为图像的高度

由于div需要内容,因此背景不显示。 2种选择: 您可以为body设置背景

<html>
<head>
<-- style block have to be contained within a <style> tag -->
<style>
    .page1{
        background-image:url(../images/1.jpg);
        background-size:cover;
        background-position:center; 
        width:100%;
        height:100%;
        display:block;
        position:relative;
     }
</style>
</head>
<body>
<div>
    <div class="page1">
    </div>
</div> <-- this tag was missing in your question -->
</body>

或者将div的高度设置为图像的高度

由于div需要内容,因此背景不显示。 2种选择: 您可以为body设置背景

<html>
<head>
<-- style block have to be contained within a <style> tag -->
<style>
    .page1{
        background-image:url(../images/1.jpg);
        background-size:cover;
        background-position:center; 
        width:100%;
        height:100%;
        display:block;
        position:relative;
     }
</style>
</head>
<body>
<div>
    <div class="page1">
    </div>
</div> <-- this tag was missing in your question -->
</body>

或者将div的高度设置为图像的高度

由于div需要内容,因此背景不显示。 2种选择: 您可以为body设置背景

<html>
<head>
<-- style block have to be contained within a <style> tag -->
<style>
    .page1{
        background-image:url(../images/1.jpg);
        background-size:cover;
        background-position:center; 
        width:100%;
        height:100%;
        display:block;
        position:relative;
     }
</style>
</head>
<body>
<div>
    <div class="page1">
    </div>
</div> <-- this tag was missing in your question -->
</body>

或者将div的高度设置为图像的高度

首先,您需要放置一个关闭按钮


现在的问题是你的
是空的。你需要在里面放一些元素,这样图像才能显示出来


首先,您需要输入一个结束语


现在的问题是你的
是空的。你需要在里面放一些元素,这样图像才能显示出来


首先,您需要输入一个结束语


现在的问题是你的
是空的。你需要在里面放一些元素,这样图像才能显示出来


首先,您需要输入一个结束语


现在的问题是你的
是空的。你需要在里面放一些元素,这样图像才能显示出来


好的,我现在明白了,你需要做些什么

<div>
    <div class="page1"></div>
    </div> 

好的,我现在明白了,你需要

<div>
    <div class="page1"></div>
    </div> 

好的,我现在明白了,你需要

<div>
    <div class="page1"></div>
    </div> 

好的,我现在明白了,你需要

<div>
    <div class="page1"></div>
    </div> 

在定义到另一个对象的路径时,我发现使用~/f1/f2/file定义文件路径比使用../f1/f2/file从当前目录开始工作更容易。~所指示的是从顶层目录开始,沿着文件结构向下运行。更容易。

在定义到另一个对象的路径时,我发现使用~/f1/f2/file定义文件路径比使用../f1/f2/file从当前目录开始工作更容易。~所指示的是从顶层目录开始,沿着文件结构向下运行。更容易。

在定义到另一个对象的路径时,我发现使用~/f1/f2/file定义文件路径比使用../f1/f2/file从当前目录开始工作更容易。~所指示的是从顶层目录开始,沿着文件结构向下运行。更容易。

在定义到另一个对象的路径时,我发现使用~/f1/f2/file定义文件路径比使用../f1/f2/file从当前目录开始工作更容易。~所指示的是从顶层目录开始,沿着文件结构向下运行。更容易。

对于一个,你有一个额外的
div
,它没有关闭(但这不是原因)。您不需要
display:block因为
div