2015-07-10 20 views
0

我在Mac机器上的NetBeans IDE ver 8.0.2中创建了一个HTML文件和一个要从外部引用的CSS文件。外部CSS在Webhost提供程序中无法运行

虽然它在桌面上以编码方式工作,但将它上传到我的托管服务提供商的public_html文件夹中,这些样式只能部分应用。

例如,名为'logo1'的内部容器没有右对齐。

PS:我知道我下面粘贴的那段代码会导致内部容器中的文本溢出。请让它不要分心。

我的HTML代码列举如下:

<!DOCTYPE html> 
 
    <!-- Home Page for Project 01 --> 
 
    <html> 
 
    <head> 
 
     <meta charset="UTF-8"> 
 
     <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
     <title> Project 01 - Key to your Technological Superiority </title> 
 
     <link rel="stylesheet" type="text/css" href="commonstyles.css" /> 
 
    </head> 
 

 
    <body> 
 
     <div class="container1"> 
 
      <div class="logo1"> 
 
      <!-- &#0169 is the code for the Copyright symbol --> 
 
       <h1> Project 01 <sup>&#0169</sup></h1>  
 
      </div> 
 
      <div class="footer1"> 
 
       <b> BIGGER BRIGHTER BETTER</b> 
 
      </div> 
 
     </div> 
 
    </body> 
 
    </html>

我的CSS代码如下所示:

div.container1 { 
 
    position:relative; 
 
    top: 0; 
 
    left: 0; 
 
    width: 600px; 
 
    height: 100px; 
 
    background-color: rgba(255,255,255,0.0); 
 
    border: none; 
 
} 
 

 
div.logo1 { 
 
    position:absolute; 
 
    top: 10px; 
 
    right: 0; 
 
    width: 300px; 
 
    height: 45px; 
 
    background-color: rgba(57,29,75,1.0); 
 
    color: white; 
 
    text-align: center; 
 
    font-family: Arial;     
 
} 
 

 
div.footer1 { 
 
    position:absolute; 
 
    top: 60px; 
 
    left: 150px; 
 
    font: Times New Roman; 
 
    font-variant: all-small-caps; 
 
}

回答

0

是个e CSS文件正确加载,即你检查路径?在这个小提琴中,代码似乎工作。

div.logo1 { 
    position:absolute; 
    top: 10px; 
    right: 0; 
    width: 300px; 
    height: 45px; 
    background-color: rgba(57,29,75,1.0); 
    color: white; 
    text-align: center; 
    font-family: Arial;     
} 

https://jsfiddle.net/1eyqtm18/

+0

嗯,这是最令人困惑的部分。除了加载到我的文件管理器中时,它可以在任何地方使用在我的桌面上,HTML和CSS文件都在同一个文件夹中。到现在为止还挺好。但是,将它们上传到** SAME **文件夹到我的托管服务提供商的文件管理器中时,奇怪的事情正在发生。例如正如代码段中所提到的,“Project 01”这个措辞正在获得一个bgcolor,但没有得到正确的理由。过去2-3天有点厌倦了这一点。 –