html - 奇怪的 CSS 问题

标签 html css

我在尝试重复图像标题时遇到了一个奇怪的 CSS 问题,由于某种原因它不起作用,这是代码,我做错了什么吗?

body {
    background:url(images/bg.png) repeat 0% 0%;
    font-family: 'Helvetica Neue', Arial, Verdana, sans-serif;
    margin: 0;
        padding: 0;
}
/* this part is not working its only showing the header in its original size I am trying to make it repeat*/

#header {
    width: 100%;
    background: url(header.png) repeat-x;
    height:44px;

}

HTML:
<div id="wrap">
    <div id="header">



    </div>
    </div>

最佳答案

这是你的道路。您的 header.png 是否与您的 CSS 文档位于同一路径?

如果不是,使用相对路径,例如:

width: 100%;
background: url(../header.png) repeat-x;
height:44px;

为图像所在的每个子文件夹添加一个 ../

关于html - 奇怪的 CSS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5969121/

相关文章:

javascript - 使用JQuery获取DT和DD元素的内容

css - css中多于三列

html - 过渡悬停div css

css - 是否可以通过 grid-template-columns 定义隐藏内容为空的列?

使用 CSS 类时,嵌套 Div 中的 HTML 嵌套 Div 不显示

html - 填充溢出文本字段中的容器

javascript - 如何从另一个选择中获取先前选择的值到当前选择 onclick?

html - 在不提供 z-index 的情况下堆叠 div

html - 使 div 在 div 下等宽

javascript - 带有翻转的jquery动画