简体   繁体   English

Visual Studio的CSS Intellisense-绝对路径和MasterPage文件

[英]Visual Studio's CSS Intellisense - Absolute paths & MasterPage files

I've noticed that to get CSS-Intellisense working in VS, the paths have to be relative - Is this the case? 我注意到,要使CSS-Intellisense在VS中工作,路径必须是相对的-是这种情况吗?

However, it seems 但是,看来

<link href="/resources/test.css" [...] />

is far more practical than 远比

<link href="resources/test.css" [...] />

I'm including the CSS in the master page, and don't see much good in including it as a content block, just to get the relative paths correct for each directory depth. 我将CSS包含在母版页中,并且将其作为内容块包含在内并没有什么好处,只是为了使每个目录深度的相对路径正确无误。 I've had a quick try with inline code resolving the path, but no dice there either (for Intellisense). 我已经尝试了使用内联代码解析路径的快速尝试,但是那里也没有骰子(对于Intellisense)。

I feel I'm missing something fairly simple - What's the correct approach here to have CSS Intellisense work across the pages in the app during dev, and render fine in any deployed state? 我觉得我缺少一些相当简单的东西-在开发期间让CSS Intellisense在应用程序的页面上正常工作并在任何已部署状态下都能正常显示的正确方法是什么?

Cheers. 干杯。

(Note - I'm aware that a <% if (false) { %> type hack is required for user controls) (注意-我知道用户控件需要<%if(false){%>类型hack))

I know this is an older question, but this works fine in VS2008. 我知道这是一个较旧的问题,但是在VS2008中可以正常工作。 If my memory serves me correctly it was fixed in a hotfix a while back: 如果我的记忆正确地为我服务,它会在一段时间后修复为修复程序:

alt text http://img168.imageshack.us/img168/8893/testgo.png 替代文字http://img168.imageshack.us/img168/8893/testgo.png

The other alternative ( if this isn't working for you still ) is adding a runat="server" and the tilde "~" 另一种选择(如果仍然无法解决问题)是添加runat =“ server”和波浪号“〜”

<link rel="stylesheet" runat="server" media="screen" href="~/css/styles.css" />

This worked for me. 这对我有用。 YMMV 青年汽车

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio.Net的“绝对定位”有什么问题,CSS的“绝对定位”如何解决这个问题? - What is the problem with Visual Studio.Net's “absolute positioning”, and how is that problem fixed by CSS's “absolute positioning”? 防止在CSS中将绝对路径放入CSS文件 - Prevent put absolute paths in javascript for css files ASP.net中CSS文件的绝对路径 - Absolute paths for CSS files in ASP.net Visual Studio 2015 CSS Intellisense破碎 - Visual Studio 2015 CSS Intellisense Broken 用于 React 中样式 CSS 的 Visual Studio Code Intellisense? - Visual Studio Code Intellisense for style CSS in React? Visual Studio Express 2013 CSS Intellisense无法正常工作 - Visual Studio Express 2013 CSS Intellisense not working Visual Studio代码中用于引导CSS类的Intellisense - Intellisense for bootstrap css classes in visual studio code Visual Studio 2015 智能感知与 css 字体真棒 - Visual studio 2015 intellisense with css font awesome 如何在.less文件上打开Visual Studio 2010 .css Intellisense - How to turn on Visual Studio 2010 .css Intellisense on .less file 如何在.less文件上打开Visual Studio 2008 .css Intellisense - How to turn on Visual Studio 2008 .css Intellisense on .less file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM