2009-09-01 51 views
1
<link href="http://www.../default.css" rel="stylesheet" type="text/css" /> 

無法編輯'http:// ...',因爲它不在網站中。VS惱人的CSS警報

我每隔五分鐘就得到一個錯誤框,我該如何讓它停止告訴我這個?

+0

你可以添加爲什麼你使用另一個網站的CSS?可能更容易直接解決問題。 – 2009-09-01 16:40:26

回答

2
<link runat="server" id="defaultCss" rel="stylesheet" type="text/css"/> 

,並在後面

defaultCss.attributes.add("href","http://www..../default.css"); 

你的代碼,如果你的CSS是在你的網站,那麼你可以使用

ResolveUrl("~/default.css") 

,以便獲得url

或可能是最好的做法是將其添加到您的應用主題文件夾http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx,然後不僅會自動添加它,但您會得到intellisense

+0

defaultCss.Attributes.Add(「href」,「http://www..../default.css」); //作品(區分大小寫) – 2009-09-01 16:58:10

2

好吧,好像是因爲你包含一個指向URL的href而不是相對的web路徑。

而不是

<link href="http://www.mysite.com/styles/default.css" rel="stylesheet" type="text/css"/> 

使用

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

此外,請確保您的交易

/> 

是在你的文檔類型方面有效。

+0

我想保持它的方式,並擺脫那個不斷的錯誤信息。 o_0這可能嗎? – 2009-09-01 16:34:22