View Full Version : I need help linking my external style sheet...


Millsy
02-27-2005, 03:59 PM
I've made my stylesheet and uploaded it to my server.
On the site it says to add this code <LINK href="mystylesheet.css" rel="stylesheet" type="text/css"> in the <head> tag on each page but I've been trying this and it isn't working!
I'm not sure if I'm doing it right though so how are you supposed to do it? :confused:
I've tried doing it like this:
<head><LINK href="stylesheet.css" rel="stylesheet" type="text/css"></head>
And like I said, it hasn't been working!
Can anyone help me?!

Sophie
xxxxxx

Chris
02-27-2005, 05:05 PM
Please do not be offended by what I am going to say - I am not implying that you are stupid.

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

Is the part in red what your stylesheet is called? And have you uploaded it to the root directory?

Millsy
02-27-2005, 05:48 PM
Hey, don't worry I'm not offended. That is what my stylesheet's called and I have checked that. It's also uploaded to my directory.
Have I put that in the right place between the <head> and </head>?
That's what I thought I could have done wrong.

Chris
02-27-2005, 05:54 PM
No, it is in the correct place.

Are the .html/.shtml/.php files in the same folder as the .css?

Millsy
02-27-2005, 06:32 PM
Yes, everything I've done so far is all in the same folder.

pb&j
02-27-2005, 06:50 PM
please provide a link to your webpage that is having the problem finding your stylesheet. thanks.

Millsy
02-27-2005, 06:54 PM
please provide a link to your webpage that is having the problem finding your stylesheet. thanks.

My site isn't published to the web at the moment. I'm planning on paying for a host but before I do that I'm trying to learn more html and I'm making sure that I know how to do everything that I'll need to.
Do you have any suggestions as to why it isn't working? I'd be really grateful because I've tried everything that I can think of!

pb&j
02-27-2005, 07:10 PM
not really anything new to suggest.
can you upload to a free server for now so we can see the problem in action? that is the easiest way to discover the problem and give you a solution.
thanks.
perhaps check your CaPiTaLiZaTiOn of your filename compared to your coding.
Stylesheet.css
is different from
stylesheet.css
and different from
stylesheet.CSS

Millsy
02-27-2005, 07:16 PM
not really anything new to suggest.
can you upload to a free server for now so we can see the problem in action? that is the easiest way to discover the problem and give you a solution.
thanks.
perhaps check your CaPiTaLiZaTiOn of your filename compared to your coding.
Stylesheet.css
is different from
stylesheet.css
and different from
stylesheet.CSS

Ok thanks, I'll try checking for capitals. If that's not the problem then I'll upload to a free server so you can have a look.

Jiru
03-01-2005, 09:28 PM
I'm in your position alot so i get frustrated usually. Here's the thing, when linking to an external style sheet you have to put this code in the head section and under the <title> tags: <link rel="stylesheet" type="text/css" href="name of stylesheet.css"> cchange the "name of stylesheet to your own name for the style sheet and make sure that you style sheet is a css document as in has .css after it. Hope it works!

MaGiCSuN
03-01-2005, 09:31 PM
allot of repeating going on here. Please only post if you got a real answer to this "problem" :) thanks !

also are you sure you left out the <style></style> tags ? And are you even sure that your whole stylesheet has proper coding? Maybe it's better to upload it eventually like suggested, or to post the coding from the .css file :)

Love,
Mirna

Millsy
03-09-2005, 06:51 PM
Thanks for all your suggestions but I still can't seem to get it to work.
I've uploaded my stylesheet to freewebs, here's the address - http://www.freewebs.com/3xsutton/stylesheet.css
That just shows the basic layout I want on my pages.
I'm not sure if that can help anyone find where I'm going wrong or not. If you need links to anything else please ask me.
Thanks, Sophie xxx

lefty
03-09-2005, 08:20 PM
Your stylesheet should only contain css codes... the rest should be on your page.
So you should remove:
<html>
<head>
<title>Title</title>
<style type="text/css">

and the </style> tag, and everything below it.

That goes into your .html page.

Mimikry
03-09-2005, 09:34 PM
allot of repeating going on here. Please only post if you got a real answer to this "problem" :) thanks !

also are you sure you left out the <style></style> tags ? And are you even sure that your whole stylesheet has proper coding? Maybe it's better to upload it eventually like suggested, or to post the coding from the .css file :)

Love,
Mirna

OHHHH my god THAT was the thing i did wrong!!!!!!!! thank you so much! i was already planning to throw my computer and everything around it through the window.

:) :) :)

Millsy
03-09-2005, 09:55 PM
Your stylesheet should only contain css codes... the rest should be on your page.
So you should remove:
<html>
<head>
<title>Title</title>
<style type="text/css">

and the </style> tag, and everything below it.

That goes into your .html page.

Right, thanks. That has helped, but it's also confused me a bit!
Should my stylesheet only include the following then?

body
{ margin-top: 0;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
}

#header {
margin: 20px;
padding: 10px;
height: 100px;
}
#left {
position: absolute;
left: 15px;
top: 160px;
width: 200px;
}
#center {
top: 0;
margin-left: 230px;
margin-right: 15px;
}

It still doesn't seem to work when I try to link it to other pages!

pb&j
03-09-2005, 11:35 PM
yes, the external style page (css) should have only css coding on it.
if you are still having problems, please upload the sample webpage you are using to test the css and provide a link to it so we can see it. so far you have only shown us your css page itself.

Millsy
03-10-2005, 07:06 PM
Here are the links to two pages

http://www.freewebs.com/3xsutton/index.htm
This one shows basically how I want the layout on each page to look

http://www.freewebs.com/3xsutton/home.htm
And on this one I have put the following:

<html>
<head>
<LINK href="stylesheet.css" rel="stylesheet" type="text/css">
<title>Title</title>

</head>
<body>


---Everything that appears on your page will be entered here, text, images etc.---


</body>
</html>

On that page I was testing to see if linking to my stylesheet would work and as you can see it hasn't. Have I done it right?

kittycat
03-10-2005, 09:30 PM
Yes it is working.
You can see that there's no margin on that page. Other than that, none of the formatting you have in the stylesheet applies to what you have on the page.

Millsy
03-12-2005, 01:25 PM
I've just read through all the css pages on the site and I think I understand css more now. Before I didn't read it properly so I didn't really know what I was doing! Thanks everyone for helping, hopefully I'll be able to work everything out now!