by-expession

Expression Web Resources

Link href does not work locally using href="/css/name.css"

Latest post 05-26-2008 10:30 AM by cdwise. 3 replies.
  • 05-25-2008 2:06 AM

    • Eric
    • Top 25 Contributor
    • Joined on 04-12-2007
    • Paris, France
    • Posts 12

    Link href does not work locally using href="/css/name.css"

    Hello,

    Using Expression and subfolders, i use the syntatx below, for example a css file.

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

    If i display the page locally and on line that works correctly.

    But if i use <link href="/css/name.css" rel="stylesheet" type="text/css"> the page is correct on-line but not locally (the / before css must be suppressed to be able to use my css or js file.

    Is it a setup problem inside Expression Web ?

    Thanks in advance,
    Eric
  • 05-25-2008 8:55 AM In reply to

    • cdwise
    • Top 10 Contributor
    • Joined on 12-22-2006
    • Houston, TX
    • Posts 527

    Re: Link href does not work locally using href="/css/name.css"

     Unfortunately Expression Web does not understand root relative urls so the latter will not work. In Expression Web all links have to document relative. If you are using a DWT then your stylesheet links will automatically be updated to document relative so in a subfolder the path would be "../css/name.css".

    If you are  using master pages you use "<link rel="stylesheet" type="text/css" href="./site.css" />" Though personally I prefer to put my site css in the root instead of in a subfolder since I've been using CSS long enough to remember browsers that had bug with file paths in CSS if the file was in other than the root and others that would not use a css file that was outside of the root so it probably is just habit.

    On a side note, what do you think of the new forum version?

    Cheryl D Wise MS MVP Expression Instructor: starttoweb.com

    Filed under:
  • 05-26-2008 4:06 AM In reply to

    • Eric
    • Top 25 Contributor
    • Joined on 04-12-2007
    • Paris, France
    • Posts 12

    Re: Link href does not work locally using href="/css/name.css"

    Thanks for your answer and i don't know if Expression Web 2 manage the relative urls...

    About the forum, using Firefox 3 RC1, my preceding message appears with a smaller font.
    I like this forum, but it is a commercial edition Sad

     

  • 05-26-2008 10:30 AM In reply to

    • cdwise
    • Top 10 Contributor
    • Joined on 12-22-2006
    • Houston, TX
    • Posts 527

    Re: Link href does not work locally using href="/css/name.css"

     V2 does not support root relative links. Sad  I keep requesting them.

    BTW, there is a free non-commercial version of this forum available from Talligent as well as a smaller CMS-blog named Grafitti. I skipped one release between our original forum and this version. I'm trying to decide whether or not to let registered members see their personal home page instead of the default one each time the visit. There you can follow threads, blogs, or whatever.

    Cheryl D Wise MS MVP Expression Instructor: starttoweb.com

Page 1 of 1 (4 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems Sponsored by: Start to Web
@ 2005-2008 Cheryl D Wise