Jump to content

external style sheet


tvbtoday

Recommended Posts

An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section: So this is the code I put in right? It doesn't work. Can someone please help me?<head><link rel="stylesheet" type="text/css"href="mystyle.css" /></head>I do not know what I'm doing wrong, but I am only a beginnier at this. The style sheet does not apply to a the pages I link. Can someone explain to me what is going on? Basically, I coded a style sheet and am I suppose to make that sheet .css extension? If I have another page right now and want it to be the layout of another page, I use the above code, right? But it doesn't work. So when I upload by files via FTP, are all my files going to be .css or .html? I'm confused. Please help. Thanks.

Link to comment
Share on other sites

CSS file is a completely seperate file from any html pages. The CSS file will tell what each html page to style so long as each html page is linked to it.Now to resolve your linking issue, you will need to determine where your html and css files are located. If they are both located together in the same root directory, then the above code you mentioned earlier should work. If the css file is in a seperate folder lets say 'css-folder' and then your file path should look like this:

<head><link rel="stylesheet" type="text/css" href="css-folder/mystyle.css" /></head>
That is one example. Another example would be is if you have a html file in one folder and the css file in another folder then the code should look something like this:
<head><link rel="stylesheet" type="text/css" href="../css-folder/mystyle.css" /></head>
Link to comment
Share on other sites

Better show us the style sheet, too, if changing the relative addresses doesn't work. Could be formatted wrong. Paste us a link or paste the WHOLE document here, including headers and whatever. (Hint: there shouldn't be any headers.)

Link to comment
Share on other sites

CSS file is a completely seperate file from any html pages. The CSS file will tell what each html page to style so long as each html page is linked to it.Now to resolve your linking issue, you will need to determine where your html and css files are located. If they are both located together in the same root directory, then the above code you mentioned earlier should work. If the css file is in a seperate folder lets say 'css-folder' and then your file path should look like this:That is one example. Another example would be is if you have a html file in one folder and the css file in another folder then the code should look something like this:
Thanks. So do I put that code above on the .css file or .html file?
Link to comment
Share on other sites

By the way, a syntax error in a CSS document will cause parsing to die for the entire document, unlike, say, HTML.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...