View Full Version : How do I set up <link> to use the same style sheet for all pages?
09-14-2007, 01:14 PM
This is a real novice question but I have to ask!
I have multiple html pages that all reside on the same web server but within different folders. I would like to use the same style sheet for all of the pages so how do I set up the <link> tag to do this?
If possible, please can you give me an example?
09-14-2007, 01:23 PM
<link href="styles/main.css" rel="stylesheet" type="text/css" media="screen" />
instead of "styles/main.css" you point it to where your main css page resides
you put that piece of code in the head part of all your web pages that you want to be pointing at the main css
09-14-2007, 01:25 PM
<link rel="stylesheet" href="/style.css" type="text/css">
where the leading forward slash tells the pages to look for the stylesheet at the root of the site. Make sure any calls to images also have the leading forward slash.
09-14-2007, 01:50 PM
also if you just want to go up a level try
<link rel="stylesheet" href="./style.css" type="text/css">
with the dot. the Dot tells it to go to parent folder
09-14-2007, 02:23 PM
And remember that the way you close the <link .... will depend on the doctype you are using:
<link .... > - for HTML
<link .... /> - for XHTML
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.