level 6
南北极星
楼主
一个CSS文件中的三个background-image,两个都显示,只有其中一个不显示,为什么啊?
就是header 那个图片不显示,可是在body中这张图是显示的,而在header中不显示。。
代码如下:
body {
margin: 1em 10%;
background-image:url(../images/pic1.jpg);
background-attachment:fixed;
background-position:top left;
background-repeat:repeat-x;
max-width:80em;
}
header {
background-image:url(../images/pic1.jpg);
background-repeat:no-repeat;
background-position:bottom right;
border-width:.1em;
border-style:solid;
border-bottom-width:0;
}
header nav {
background-image:url(../images/navBg.jpg);
background-position:bottom right;
background-repeat:repeat-x;
border-width:.1em;
border-style:solid;
border-bottom-width:0;
border-top-width:0;
padding-left:10%;
}
html代码:
<body>
<img src="./images/logo.jpg" alt="我的地盘我做主" />
<header>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="photos.html">Photos</a></li>
<li><a href="live.html">Live</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<article>
<h1>Lorem Ipsum Dolor</h1>
</article>
</body>
</html>
2018年05月10日 18点05分
1
就是header 那个图片不显示,可是在body中这张图是显示的,而在header中不显示。。
代码如下:
body {
margin: 1em 10%;
background-image:url(../images/pic1.jpg);
background-attachment:fixed;
background-position:top left;
background-repeat:repeat-x;
max-width:80em;
}
header {
background-image:url(../images/pic1.jpg);
background-repeat:no-repeat;
background-position:bottom right;
border-width:.1em;
border-style:solid;
border-bottom-width:0;
}
header nav {
background-image:url(../images/navBg.jpg);
background-position:bottom right;
background-repeat:repeat-x;
border-width:.1em;
border-style:solid;
border-bottom-width:0;
border-top-width:0;
padding-left:10%;
}
html代码:
<body>
<img src="./images/logo.jpg" alt="我的地盘我做主" />
<header>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="photos.html">Photos</a></li>
<li><a href="live.html">Live</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<article>
<h1>Lorem Ipsum Dolor</h1>
</article>
</body>
</html>