Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cant get simple external stylesheet to work 2

Status
Not open for further replies.

kevint21

Programmer
Apr 25, 2001
52
GB
I created a test webpage on my desktop called index.html and stylesheet called style.css both inside a folder called css-site but it doesnt get the path to the stylesheet i think. Anyone see what i'm doing wrong.

<html>
<head>
<link href="C:/Documents and Settings/Administrator/Desktop/css-site/styles/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<h1>My heading1</h1>
<h2>My heading2</h2>
<h3>My heading3</h3>
<h4>My heading4</h4>


<pText, text text text</p>

</body>
</html>


 
First if your under windows, the slahes should e back slahesÑ

C:[red]\[/red]Documents and Settings[red\[/red]....


Why are you using absolute paths??? Something like:

/styles/style.css should be enough.

So try doing this:

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



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Relative URLs are the way to go, but you need to do it like this:
Code:
<link href="styles/style.css" rel="stylesheet" type="text/css">
i.e. without the leading slash. "/styles/style.css" means "a file called style.css, in a directory called styles below the root directory (i.e. C:\styles\style.css in Windows terms)". "styles/style.css" means ""a file called style.css, in a directory called styles below the current directory".

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
This one here worked for me

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

Thanks to both of the above for valuable posts though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top