enter image description here这是我的第一个HTML项目,在这里我试图为#nheader id设置背景图像但是当我切换鳕鱼时,浏览器告诉我它无法加载我不知道原因?
<html>
<!--this is the
start html file-->
<head>
<meta keywords="html, laern, teach"/>
<link rel="stylesheet" type="text/css" href="style.css">
<title> this is a website </title>
</head>
<body>
<div id="wrap">
<div id="nheader">
<h1>how to write html5</h1>
<img src="..my demo/images/body.jpg">
</div>
<div id="npara">
<p class="text_para">
Lorem ipsum dolor sit amet, <span class="color">consectetur</span> adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
</p>
</div>
<div id="footer">
<p class="text_para">
this is footer
</p>
</div>
</div>
</body>
<!--here ends th html file -->
</html>
答案 0 :(得分:1)
您的图片不起作用,因为它的路径不正确。路径可以是:
http://example.com/images/body.jpg
./images/body.jpg
,../../images/body.jpg
)/images/body.jpg
,~/img/logo-free.png
)有关路径如何在不同系统上工作的更多信息,请考虑阅读Wiki:Path (computing)。
记住,任何服务器(域)实际上都托管在一台机器(计算机)上,因此,它的文件夹结构可以通过其路径系统访问(有关Web的限制)。
绝大多数Web域都托管在Linux(Unix shell系统)上。