CSS样式表不会链接

时间:2016-09-30 00:15:09

标签: html css

链接我的CSS样式表突然停止了工作?

CSS文件是一个文件夹。另外,我使用IDE自动填充功能填写href。

此外,这是来自Lynda.com的练习档案



<cfquery datasource="photogallerydb" name="qPhotographer">
  SELECT * FROM Photographer WHERE featured = 1
</cfquery>
<cfquery datasource="photogallerydb" name="qPhotos">
  SELECT * FROM Photo WHERE photographerid = #qPhotographer.photographerid#
</cfquery>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Our Photo Gallery</title>
  <link rel="stylesheet" type="text/css" href="../styles.css" media="all" />
</head>

<body>

  <div id="main">
    <div id="header">
    </div>
    <div id="navbar" align="center">
      <a href="../home">Home</a>
      <a href="../photographers">Photographers</a>
      <a href="../photos">Photos</a>
    </div>
    <br class="clearfloat" />
    <div id="content">
      <h1>Our Featured Photographer</h1>
      <cfoutput>
        <h2>#qPhotographer.Firstname# #qPhotographer.Lastname#</h2>
      </cfoutput>

      <cfdump var="#qPhotos#">

    </div>
    <div id="footer">
      Copyright &copy;2009 Our Photo Gallery
    </div>
  </div>

</body>

</html>
&#13;
&#13;
&#13;

CSS:

&#13;
&#13;
body {
	background-color: #ABBAF1;
	margin:0px;
	padding:0px;
}
body, table {
	font-family:Arial, Helvetica, sans-serif; 
}
h1 {
	font-size:1.2em;
	font-weight:bold;
}
h2 {
	font-size:1.1em;
	font-weight:normal;
}
h3 {
	font-size:.9em;
	font-weight:normal;
}
img {
	border:0px;
}
div {
	margin:0px;
	padding:0px;
	font-size:16px;
}
.clearfloat {
	clear:both;
	height:0px;
}
a {
	color:#000000;
	text-decoration:underline;
}
a.hover {
	text-decoration:underline;
}
#main {
	background-image: url(images/background.jpg);
	width:760px;
	border: 0px;
	height: 1400px;
	margin-top: 20px;
	margin-right: auto;
	margin-bottom: 0px;
	margin-left: auto;

}
#header {
	background-image: url(images/banner.jpg);
	height: 100px;
	width:inherit;
}
#navbar {
	background-color: #434DD1;
	height:2em;
	width:inherit;
	color: #CCC;
	padding-top: 15px;
}
#navbar a {
	color: #FFF;
	font-size: 18px;
	font-weight:bold;
	text-decoration:none;
	margin-left:15px;
	margin-right:15px;
}
#navbar a.visited {
	color: #FFF;
}
#content {
	padding-left:20px;
	padding-right:40px;
	padding-bottom:20px;
	padding-top:10px;
	min-height:300px;
}
#footer {
	padding-left:20px;
	padding-right:20px;
	font-size:12px;
	font-style:italic;
}
.oddrow {
	background-color:#fff;
}
.evenrow {
	background-color:#00ffff;
}
&#13;
&#13;
&#13;

Firefox调试器:

Status report</p><p><b>message</b> <u>/photogallery/styles.css</u>  </p><p><b>description</b> <u>The requested resource is not available.</u></p><hr class="line"><h3>Apache Tomcat/8.0.27</h3></body></htm

文件的位置:

URL:     http://localhost:8500/photogallery/home/index.cfm

HTML:     C:\ ColdFusion2016 \ cfusion \ wwwroot的\照相馆\家\ index.cfm

CSS:     C:\ ColdFusion2016 \ cfusion \ wwwroot的\照相馆\ styles.css的

2 个答案:

答案 0 :(得分:2)

来自服务器的错误消息使用小写photogallery来讨论p,但您的路径指示Photogallery,大写为P。这是什么? Windows可能会在路径中区分大写和小写的方式和/或服务器如何处理它们时遇到问题。我个人建议不要在Windows中的路径中使用大写字母,或者在空格中使用大写字母。当您指定主页的URL时,您使用的是小写或大写版本吗?

有关此问题的详细信息,请参阅this answer

答案 1 :(得分:0)

您的h3没有关闭}可能导致css无法正确显示。同时尝试从路径和文件夹中删除空格:photo%20gallery

请参阅此帖子的相关问题:HTML: href syntax : is it okay to have space in file name