html就像这样:
<html>
<head>
<title>In Loving Memory of Jill Erin Hayes</title>
<link rel="stylesheet" type="text/css" href="/additional_pages/fp_frye.css" />
</head>
<body>
<div id="maincontent">
<div id="left">
<h1>Jill E. Hayes</h1>
<ul><li>mother</li>
<li><a href="https://www.utm.edu/departments/finearts/vanguard/index.php">actress</a></li>
<li>election commissioner</li>
<li>and so very much more</li>
</div>
<div id="right">
<h2>Her Story</h2>
<p>Born to Jerry and Debbie Hayes in Henry, TN in 1980, Jill was always very creative and fun.
She flew through school, active in 4-H and theatre, all while maintaining good grades and a
positive outlook on life. She attended the University of Tennessee at Martin after graduating Henry
County High School, and in college, she majored in theatre and was a very active member of UTM's
Vanguard theatre program. She met Joseph Frye in college, and the married and had two children,
Shelby, named after her favorite play, <i>Steel Magnolias</i>, and Hayes, named for her maiden name.</p>
<p>Jill gave up her dreams of Broadway to be a mother, and she got a job as the Henry County
Administrator of Elections, where she not only helped her police officer husband raise their family, but
also was able to be active in the democratic system, which she had always been passionate about. She worked
elections for fifteen years before illness struck, and she was forced to resign to focus on regaining her
health.</p>
<p>Lupus is, unfortunately, into a disease that garners much attention, despite being a fatal one. Jill went
to countless doctors attempting to find out what was wrong with her before she was finally diagnosed with lupus,
an aggressive autoimmune disease. This on top of being forced to quit her job as well as the divorce that
ended a regrettably failing marriage was hard on her, but she still persevered to be the mother that
both of her children needed. She managed to live with lupus for six years, before passing away at her parents'
home on October 18, 2015, just weeks before her 25th birthday.</p>
</div>
</div>
</body>
</html>
然后我的Css文件是这样的:
body {
background-color:light-green;
}
#maincontent {
background-color:white;
width:680px;
height:400px;
padding-top:20px;
padding-left:20px;
padding-right:20px;
}
#left {
background-color:light-pink;
width:200px;
float:left;
height:200px;
}
#right {
background-color:light-green;
width:400px;
float:left;
margin-left:40px;
height:200px;
}
我不明白为什么它不能链接,我已经访问过这个主题的其他几个论坛主题。我对编码非常陌生 - 这是一个毕业所需的课程 - 我需要帮助。
答案 0 :(得分:1)
根据您发布的内容,您的css文件应位于名为 additional_pages 的目录中,并且名称应为 fp_frye.css
检查您的css文件是否在正确的位置!
UPD:
更改此行:
<link rel="stylesheet" type="text/css" href="/additional_pages/fp_frye.css" />
为:
<link rel="stylesheet" type="text/css" href="additional_pages/fp_frye.css" />
注意第一个代码中的“/”是试图访问c:/additional_pages/fp_fryes.css,当真正的路径不是那样的时候!