homepage Welcome to WebmasterWorld Guest from 107.20.131.154
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: DrDoc

CSS Forum

    
CSS Wont appear when linked externally
alleria21




msg:4514378
 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




msg:4514400
 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:4514408
 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




msg:4514420
 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




msg:4514442
 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




msg:4514451
 1:05 am on Nov 1, 2012 (gmt 0)

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

lucy24




msg:4514496
 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:4514669
 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




msg:4514826
 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:4515450
 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




msg:4515481
 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:4515642
 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:4516903
 10:34 pm on Nov 7, 2012 (gmt 0)

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

lucy24




msg:4516942
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved