Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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/CSS背景问题_Html_Css - Fatal编程技术网

HTML/CSS背景问题

HTML/CSS背景问题,html,css,Html,Css,正文 { 背景:url(“Images/Wheat.jpg”); } P { 字体系列:“无衬线”; 字体大小:20px; 文本对齐:对齐; } a:链接,a:已访问{ 显示:块; 宽度:120px; 字体大小:粗体; 颜色:#FFFFFF; 背景色:#DEB887; 文本对齐:居中; 填充:50px; 文字装饰:无; 文本转换:大写; 高度:自动; 底部:0; 排名:0; 左:0; 右:0; } a:悬停,a:活动{ 背景色:#E2A76F; } 氢 {颜色:#996633; 字体系列:Ari

正文
{
背景:url(“Images/Wheat.jpg”);
}
P
{
字体系列:“无衬线”;
字体大小:20px;
文本对齐:对齐;
}
a:链接,a:已访问{
显示:块;
宽度:120px;
字体大小:粗体;
颜色:#FFFFFF;
背景色:#DEB887;
文本对齐:居中;
填充:50px;
文字装饰:无;
文本转换:大写;
高度:自动;
底部:0;
排名:0;
左:0;
右:0;
}
a:悬停,a:活动{
背景色:#E2A76F;
}
氢
{颜色:#996633;
字体系列:Arial;
文本对齐:居中;
字体大小:200%;
}
h3
{
字体系列:无衬线;
字体:斜体;
文本对齐:左对齐;
字体大小:130%;
}
h4
{
颜色:#996633;
字体系列:Arial;
字体:斜体;
文本对齐:左对齐;
字号:200%;;
}
h5
{
颜色:#996633;
字体系列:Arial;
字体:斜体;
文本对齐:左对齐;
字号:200%;;
}
h6
{
字体系列:无衬线;
字体:斜体;
文本对齐:左对齐;
字体大小:130%;
}
@媒体印刷品{
p{
字体大小:24px;
颜色:黑色;
}
}
这是对的,

但请检查地图名和文件名中是否有大写字母

如果是这种情况,请检查以下各项:

  • 如果您有一个放置.css文件的样式文件夹,请检查“图像”文件夹是否在样式文件夹中。如果情况是好的,如果不是&您的“Images”文件夹位于主目录中,请使用以下命令:

    背景:url(“../Images/Wheat.jpg”)


  • 。/
    所做的是返回1张地图,然后它将进入图像文件夹并选择您的图像。首先,确保图像路径正确,包括大写字母和路径。目前,这个CSS文件所在的文件夹假设其中有一个名为“Images”的文件夹,您的图像“Wheat.jpg”就在其中。这是正确的吗

    CSS样式中有几个错误,您有一个额外的%符号。我还整理了你的CSS代码,这样更容易阅读

    此外,链接和访问中的顶部、左侧、底部和右侧值,您不需要这些值,因为它们仅对绝对和相对定位项目有效,而您的是块

    body {
        background:url("Images/Wheat.jpg");
    }
    
    p {
        font-family: "Sans-serif";
        font-size: 20px;
        text-align: justify;
    }
    
    a:link, a:visited {
        display: block;
        width: 120px;
        font-weight: bold;
        color: #FFFFFF;
        background-color: #DEB887;
        text-align: center;
        padding: 50px;
        text-decoration: none;
        text-transform: uppercase;
    }
    
    a:hover, a:active {
        background-color: #E2A76F;
    }
    
    h2 {
        color:#996633;
        font-family:Arial;
        text-align: center; 
        font-size: 200%;
    }
    
    h3 {
        font-family:Sans-serif;
        font-style: italic;
        text-align:left;
        font-size: 130%;
    }
    
    h4 {
        color:#996633;
        font-family:Arial;
        font-style: italic;
        text-align:left;
        font-size: 200%;
    }
    
    h5 {
        color:#996633;
        font-family:Arial;
        font-style: italic;
        text-align:left;
        font-size: 200%;
    }
    
    h6 {
        font-family:Sans-serif;
        font-style: italic;
        text-align:left;
        font-size: 130%;
    }
    

    请粘贴您的代码,不要包含图像。您是否检查了文件的相对路径?最佳猜测:您的背景图像与链接显示的位置不符。备选猜测:您有区分大小写的文件名,CSS中的大小写与文件或目录中的大小写不匹配。我已仔细检查了路径,它工作正常,我在该网站上发布代码时也遇到问题,请耐心等待,否则我会解决间距问题。@KeeleyLouiseWainman在您的浏览器中打开开发者工具,F12 for Chrome/FireFox/Internet Explorer,然后刷新您的页面。如果页面找不到您的图像,则会出现
    404无法找到资源
    错误。
    
    body {
        background:url("Images/Wheat.jpg");
    }
    
    p {
        font-family: "Sans-serif";
        font-size: 20px;
        text-align: justify;
    }
    
    a:link, a:visited {
        display: block;
        width: 120px;
        font-weight: bold;
        color: #FFFFFF;
        background-color: #DEB887;
        text-align: center;
        padding: 50px;
        text-decoration: none;
        text-transform: uppercase;
    }
    
    a:hover, a:active {
        background-color: #E2A76F;
    }
    
    h2 {
        color:#996633;
        font-family:Arial;
        text-align: center; 
        font-size: 200%;
    }
    
    h3 {
        font-family:Sans-serif;
        font-style: italic;
        text-align:left;
        font-size: 130%;
    }
    
    h4 {
        color:#996633;
        font-family:Arial;
        font-style: italic;
        text-align:left;
        font-size: 200%;
    }
    
    h5 {
        color:#996633;
        font-family:Arial;
        font-style: italic;
        text-align:left;
        font-size: 200%;
    }
    
    h6 {
        font-family:Sans-serif;
        font-style: italic;
        text-align:left;
        font-size: 130%;
    }