当网站在线上传时,CSS文件没有链接到HTML文件 [英] CSS file not linking to HTML file when website uploaded online

查看:139
本文介绍了当网站在线上传时,CSS文件没有链接到HTML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我的电脑上测试了我的网站,没有任何网站托管,我的html文档和css文档链接完美。但是,当我决定在000webhost上在线试用它时,我上传了这两个文件,并确保这些目录是正确的,但是html文档没有任何风格。有人可以帮助我,我是新的东西。

I have tested out my website from my computer without any web hosting and my html document and css document are linking perfectly. However, when i decided to try it out online on 000webhost, i uploaded both files and made sure that the directories were correct, but the html document ended up with no style whatsoever. Can someone please help me, I'm new with this stuff.

<!DOCTYPE html>
<html>
    <head>
        <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
        <title>BandRate</title>
    </head>
<body class="page">
    <div class="title">
        <div id="title">
            <span class="capital_letter">B</span>and<span class="capital_letter">R</span>ate
        </div>
        <a href="test.html" id="SignUp">Band Sign Up</a>
    </div>
</body>
</html>

CSS:

CSS:

.page {
    background-color:#FF0000;
}
.title {
    position:relative;
    top:0px;
    left:0px;
    width:100%; 
    height:75px; 
    background-color:#800000;
}
#title {
    font-family:broadway;
    font-size:60px;
    color:#FF0000;
    position:absolute;
    left:5px;
    top:0px;
}
#SignUp {
    position:absolute;
    background-color:#690404;
    right:0px;
    top:0px;
    padding-right:10px;
    padding-left:10px;
    font-family:broadway;
    font-size:20px;
    color:#ff0000;
    padding-top:26px;
    padding-bottom:26px;
    text-decoration:none;
}
#SignUp:hover {
    background-color:#540303;
}   
.capital_letter {
    color:white;
}


推荐答案

检查您的html文件位于css文件所在的同一目录中。

check to see if your html file is in the same directory where the css file is.

如果不是这样,而不是像这样链接您的css文件 -

if not then instead of linking your css file like this -


stylesheet.css

"stylesheet.css"

像这样链接 -


name_of_directory / stylesheet.css

"name_of_directory/stylesheet.css"

如果您的css文件是在一个目录中,你的HTML文件在其他目录中,然后像这样链接你的CSS -

if your css file is in a directory and your html file is in other directory then link your css like this -

../ name_of_directory / stylesheet.css

"../name_of_directory/stylesheet.css"

你也可以像这样链接你的css文件:

you could also link your css file like this:


http://your_website.com/name_of_directory/stylesheet.css

这篇关于当网站在线上传时,CSS文件没有链接到HTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆