Results 1 to 5 of 5

Thread: Css Linking Problem

  1. #1
    Join Date
    Jul 2006

    Css Linking Problem

    Hi All

    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 ???
    Any suggestions??

    Thanks a million,

  2. #2
    Join Date
    Aug 2006
    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!

  3. #3
    Join Date
    Feb 2003
    Michigan, USA
    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.

  4. #4
    Join Date
    Aug 2006
    Quote Originally Posted by aoife
    I am linking to the Css file through my master page. ...
    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?

    Again, sorry if this is insulting but sometimes it's something simple.

  5. #5
    Join Date
    Jul 2006

    resolved Problem solved!!

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center