背景图片不会出现在HTML中

时间:2019-04-03 01:17:52

标签: html5 css3

我想将图片放在标题中,但没有显示出来。

我尝试查找拼写错误,缺少结尾的分号,在不同的浏览器中进行了尝试,并确保图片与其余HTML和CSS文件位于同一文件夹中...不知道还要做什么做。这就是我在CSS中编码标题的方式。

header { background-color: #9BC1C2;
   background-image: lilyheader.jpg;
   background-position: right;
   background-repeat: no-repeat;
   height: 150px; }

我希望标题显示在网站的每个页面上,并且标题上也应该显示标题。

3 个答案:

答案 0 :(得分:0)

您必须像这样放置一对括号:

background-image: url(lilyheader.jpg);

正确的方法是

header {
    background-color: #9BC1C2;
    background-image: url(lilyheader.jpg);
    background-position: right;
    background-repeat: no-repeat;
    height: 150px;
}

答案 1 :(得分:0)

就像上面的家伙提到的那样,请确保您在字符串中指定正确的路径(如果该路径不起作用),那么一定要得到您的许可,并转到终端,并使用chmod 404或605来选择文件。

示例:

cd public_html
chmod 404 logo.jpg

答案 2 :(得分:-1)

请检查您的jpg路径,使用相对路径还是绝对路径。

相关问题