CSS没有通过服务器加载

时间:2015-03-30 18:24:32

标签: html css

我正在尝试使用以下代码在我自己的服务器上运行我的网站:http://fragments.turtlemeat.com/javawebserver.php

虽然当我在本地运行我的网站并且在真实服务器上运行时,一切都运行良好,但是当我通过自己的服务器运行时,我无法加载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>

2 个答案:

答案 0 :(得分:0)

检查您的文件路径是否与您的css文件一致。

此链接标记

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

假设在与CSS相同的文件夹中有一个大写的javawebserver.php文件夹。

如果是根,那就是

/javawebserver.php 
/CSS/default.css

答案 1 :(得分:0)

确保您的css文件夹以大写重命名。在本地计算机(Windows文件系统)上,对“css”,“CSS”甚至“cSs”的引用是对同一文件夹的引用。因此,如果您的文件夹以小写命名,则链接可以在本地计算机上运行。 另一方面,Linux / UNIX文件系统区分大小写,因此在Apache Web服务器上,只有在使用正确的大写/小写引用文件夹或文件时,链接才会起作用。