homepage Welcome to WebmasterWorld Guest from 184.73.104.82
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
CSS Wont appear when linked externally
alleria21



 
Msg#: 4514376 posted 9:31 pm on Oct 31, 2012 (gmt 0)

Hello to all web lovers!
This nasty code here wont link the CSS external file to it (css and html page are in the same folder , having the same problems when trying to link external JS scripts to an html page but that is non relevant for now)

Page Code


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>The First Web Page</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<h1> Niaou</h1>
<hr>
<p>

In the beginning, Tim created the HyperText Markup Language. The Internet<br>
was without form and void, and text was upon the face of the monitor and<br>
the Hands of Tim were moving over the face of the keyboard. And Tim said,<br>
Let there be links; and there were links. And Tim saw that the links were<br>
good; and Tim separated the links from the text. Tim called the links<br>

</p>
</body>
</html>





and...... CSS code
styles.css

body
{
color: blue;
background-color: yellow;
}



tried mozilla + IE 8 but no good for now :/ can you figure out what is possibly wrong with it? im imagining maybe wrong doctype but not sure though....

 

birdbrain

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4514376 posted 10:14 pm on Oct 31, 2012 (gmt 0)

Hi the alleria21,

it worked OK for me. ;)

If it does not work for you, and the two files are in the same location, then
check that your css file name does in fact correspond with that used here...

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


birdbrain

alleria21



 
Msg#: 4514376 posted 10:29 pm on Oct 31, 2012 (gmt 0)

After having checked tha names are the exact same (copied the name from file and pasted it at source code )it still doenst work and cant figure out whats happening O_o

birdbrain

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4514376 posted 11:20 pm on Oct 31, 2012 (gmt 0)

Hi there alleria21,

as I said in my previous post, it worked OK for me.

I created two files from the exact code that you provided and named the css file "styles.css".

The html page was tested in IE9, Firefox 16.0.2, Opera 12.02 and Safari 5.1.7.

You must be in error, somewhere, if it is not working for you. ;)

birdbrain

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4514376 posted 12:40 am on Nov 1, 2012 (gmt 0)

Never mind where the files are physically located. Is the URL of the html file (what you see in your browser's address bar) the same as the html's "real" location?

For live sites it is always safer to use site-absolute links beginning in / (slash = top level of your domain). It makes local testing a little trickier, because you'll have to run it through a pseudo-server like MAMP or WAMP. But that's not hard.

drhowarddrfine

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4514376 posted 1:05 am on Nov 1, 2012 (gmt 0)

Did you give the files read permission or are they restricted?

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4514376 posted 4:21 am on Nov 1, 2012 (gmt 0)

:: belated D'oh! moment ::

What do your logs say? You should see requests for the stylesheet. Are they asking for the right file in the right place? What response does the request get?

alleria21



 
Msg#: 4514376 posted 2:04 pm on Nov 1, 2012 (gmt 0)

The files are executing as Admin that means all rights are open :P could you tell me where i can see the request logs lucy24? :D

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4514376 posted 10:14 pm on Nov 1, 2012 (gmt 0)

Is all this happening in a "live" site or are you testing locally? I'd assumed live. (Not necessarily open to the public, but online.) How and where you find the logs depends on your host. If you don't have access to the raw logs, change hosts ;)

If you're working on a local pseudo-server like WAMP, the logs are hiding somewhere in its folder.

:: detour to look, because I've never bothered about mine ::

Oh. Guess I'd have to change something in the config file, because I can only find error logs. Those should be enough though, because they say what the request is and what response it gets. (Again: That's for MAMP. My real site logs live in the same place as the real error logs. It's a separate login-- haha --from the site itself.)

You can also use an extension like Firefox's Live Headers to track each request separately. And then save the output for careful reading later.

Is this a hand-coded site or is there a CMS involved?

alleria21



 
Msg#: 4514376 posted 9:38 pm on Nov 3, 2012 (gmt 0)

It's about a hand coded site and im running it localy using WAMP .Tbh i didnt use WAMP at the first few runs i just saved the file as html and opened it with mozila +chrome :P but no progress though :P

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4514376 posted 11:42 pm on Nov 3, 2012 (gmt 0)

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

If you look at error logs or something with Live Headers, do you see a request for this file? Have you tried deleting the line and re-typing it manually to make sure no invisible entities sneaked in? Every now and then someone has a problem which turns out to involve a Zero-Width Space or a misplaced BOM.

alleria21



 
Msg#: 4514376 posted 6:09 pm on Nov 4, 2012 (gmt 0)

there might be an issue with the type of html being used here (XHTML) read that there issues involved when linking CSS and JS scripts :P i will try the live headers and post results.Thanks in advance lucy24 :D

seoskunk



 
Msg#: 4514376 posted 10:34 pm on Nov 7, 2012 (gmt 0)

Sounds like a permissions problem, check the permissions of the css file

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4514376 posted 1:44 am on Nov 8, 2012 (gmt 0)

If it were a permissions issue it would show up in logs, probably as a 401. But the request would definitely be present.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved