2015-03-30 44 views
0

我正在嘗試運行我的網站從我自己的服務器使用此:http://fragments.turtlemeat.com/javawebserver.phpCSS未通過服務器加載

雖然當我在本地運行我的網站並在真正的服務器上運行它時,一切正常,但我無法通過我自己的服務器運行它時加載CSS。

這裏是我的HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> 
<html lang="en"> 
<head> 
<meta content="text/html: charset=utf-8" http-equiv="Content-Type"/> 
<title>AddictingJava</title> 
<link rel="stylesheet" href="CSS/default.css" type="text/css" /> 
</head> 
<body> 
<header> 

</header> 
<!-- Navigation Start --> 
<section class="Nav">  
     <section class="Logo"> 
      <nav class="HomeLogo"> 
       <a href="index.html" class="HomeLogoLink" title="Home"></a> 
      </nav> 
     </section> 
     <ul> 
     <li><nav class="GamesButton"> 
      <a href="Games/games.html" class="GamesButtonLink" title="Games"></a></li> 
     </nav> 
     <li><nav class="ProfileButton"> 
      <a href="Profile/profile.html" class="ProfileButtonLink" title="Profile"></a></li> 
     </nav> 
     <li><nav class="ForumsButton"> 
      <a href="Forums/forums.html" class="ForumsButtonLink" title="Forums"></a> 
       <ul id="DropNav"> 
        <li><a href="Forums/GeneralDiscussion/generaldiscussion.html" title="General Discussion">General Discussion</a></li> 
        <li><a href="Forums/Contact/contact.html" title="Contact Us">Contact Us</a></li>    
       </ul> 
     </li> 
     </nav> 
     <li><nav class="NewsButton"> 
      <a href="News/news.html" class="NewsButtonLink" title="News"></a></li> 
     </nav> 
     </ul> 
</section> 
<nav class="Download"> 
    <a href="http://www.addictingjava.com/Jars/2014-06-21-WorldDomination AJ Client.jar">Get Client</a> 
</nav> 
     <!-- Navigation End --> 
<section class="AboutSite"> 
    <article> 
     <p>AddictingJava is a site dedicated to bringing you a unique experience with minI game sites. We hope to get user feedback as we grow and make the site a very fun place to visit overall. Although it doesn't seem like this site has very much we are currently planning a lot for it, so be sure to check back regularly to see when we update the site.<br><br> 
     If you wish to download our client click <a href="Games/games.html">here</a> or the Get Client button above. 
    </article> 
</section> 
<section class="RecentNews"> 
    <figure class="TopRecentNewsPicture"> 
     <img src="websitepics/newnewspic.png"> 
    </figure> 
    <article class="TopRecentNews"> 
     <h5>7/7/2014 - Announcment.</h5> 
     <p>Read all about things we are working on as of today.</p> 
    </article> 
    <figure class="MidRecentNewsPicture"> 
     <img src="websitepics/newgamepic.png"> 
    </figure> 
    <article class="MidRecentNews"> 
     <h5>7/7/2014 - Client added.</h5> 
     <p>The AddictingJava Client was added.</p> 
    </article> 
    <figure class="BotRecentNewsPicture"> 
     <img src="websitepics/newnewspic.png"> 
    </figure> 
    <article class="BotRecentNews"> 
     <h5>3/14/2014 - Website created!!!!</h5> 
     <p>The begining of everything.</p> 
    </article> 
</section> 
<section class="footer"> 
    <p>© 2014 AddictingJava, Inc. All rights reserved. </p> 
</section> 
</body> 
</html> 
+0

打開瀏覽器的開發工具。 CSS的URL是否準確?返回的代碼是什麼? – Celeo 2015-03-30 22:19:05

回答

0

檢查,看看你的文件路徑是正確的CSS文件。

此鏈接標籤

<link rel="stylesheet" href="CSS/default.css" type="text/css" /> 

假設有在同一文件夾中javawebserver.php大寫CSS文件夾。

如果是在根那將是

/javawebserver.php 
/CSS/default.css 
+0

如果它在錯誤的文件路徑中,這是否意味着它不會在本地工作?導致它在本地工作也適用於我的付費服務器。 – CrimOudin 2015-03-30 18:42:40

+0

不知道您的確切設置很難說。我假設你在本地有一個名爲CSS的目錄與你的php文件在同一個目錄下。如果這是你正在討論的http://fragments.turtlemeat.com/javawebserver.php的實際url,它在這裏尋找css文件http://fragments.turtlemeat.com/CSS/default.css,當我點擊該鏈接我得到一個404錯誤,這意味着沒有文件存在於該位置的服務器上。您的本地設置可能有多個項目。你正在運行本地Web服務器嗎?如果是的話,你的操作系統敏感?你上傳的CSS文件到你的服務器? – whoacowboy 2015-03-30 18:49:50

0

確保你的CSS文件夾中大寫改名。在本地機器上(windows文件系統),對「css」,「CSS」甚至「cSs」的引用是對同一文件夾的引用。因此,如果您的文件夾以小寫字母命名,則鏈接將在您的本地計算機上運行。 另一方面,Linux/UNIX文件系統區分大小寫,因此在Apache Web服務器上,鏈接只有在文件夾或文件以正確的大寫/小寫引用時纔有效。