Css Linking Problem
I am having problems linking to a stylesheet in my website.
I am linking to the Css file through my master page. so that every page in my site uses the same stylesheet (which is stored in a folder called Css
<link rel="Stylesheet" type="text/css" href="~/Css/style.css" />
This does not seem to work though ???
Thanks a million,
try removing the ~ and if that doesn't work try making the link absolute.
To make sure that you have the correct link just type it into the address bar:
Hope that helps!
href="/~Css/style.css" is probably what you want. Seems like your site is running on a unix or linux server, since ~foo is usually a symlink to another directory. And if it is *nix, make sure the file path is spelled EXACTLY in your HTML file as it would be in the operating system. File paths and names are case sensitive.
'Course, I may have told you stuff you already knew. In that case, my apologies.
I'm sorry if this insults your intelligence - it's not my intent, but the wording of your question made me wonder if you thought you could specify the stylesheet on one page and have it work on another. What do you mean by "master page"? You know that you need to reference the style sheet from all of the pages right?
Originally Posted by aoife
Again, sorry if this is insulting but sometimes it's something simple.
No Problem Red .... did not explain it the best ....
baically my problem was that using '~/' or just '/'
did not seem to be referencing the root of my .net site
i wanted to be able to link to a stylesheet using by linking to it in my master page (master page in .net can contain menus, functionality, icons etc that you would like to appear in every page in your site.... any code, links etc in the master page are included in any child pages). I needed this link to reference the stylesheet from the root of my site in order for it to work in any pages that were put in a subfolder in my site structure.
Found out that the problem is that the root folder name must be used in the path .....i.e the path '/mySitesRootFolderName/Css/myStylesheet.css' worked.
Thanks a million for everybodys help
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)