2016-02-29 38 views
-2

HTML是像這樣:我的HTML和CSS文件將無法鏈接的請求

<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; 
} 

我不明白爲什麼它贏得」 t鏈接,並且我訪問了關於此主題的其他幾個論壇主題。我對編碼非常陌生 - 這是一個需要畢業的班級 - 我需要幫助。

+0

什麼是您的文件結構? –

+0

是否檢查過瀏覽器的調試控制檯?也許你的'href'是錯誤的。 –

+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,當真正的路徑不是那個!

+0

@Shelby,檢查這是否解決了你的問題! –