CSS在vs2010 Web项目中不起作用 [英] css does not work in vs2010 web project
问题描述
阅读以下内容后,您能明白为什么我没有让CSS工作吗?谢谢
也许我必须为此CSS放置一些东西?
我正在使用VS2010构建Web项目.
我已添加文件夹App_Themes.
在其下有一个名为AADefault的子文件夹.在此之下有AA.css
在AA.css内部,我添加了以下内容:
Hi,
After reading the following, can you see why I do not get the css to work please? thanks
Maybe there is something I have to place for this css?
I am using VS2010 to build a web project.
I have added the folder App_Themes.
Under it there is a subfolder called AADefault. Under this there is AA.css
Inside AA.css I have added the following:
.DepartmentListContent
{
...
}
.ascx文件的源代码中包含以下内容:
The .ascx file has this in the source:
<asp:DataList ID="list" runat="server" Width="200px" CssClass="DepartmentListContent">
我应该在web.config中放入任何内容吗?
我起步了
Should I put anything in the web.config?
I paced
<pages themes="AA.css" />
但是有一个错误说它无法识别,它指向页面
But there is an error it says unrecognized which refers to pages
推荐答案
您需要在aspx页面中添加对外部CSS样式表的引用.
例如.
You need to add a reference to an external CSS stylesheet in your aspx page.
E.g.
<link href="CSS/StyleSheet.css" rel="stylesheet" type="text/css" />
您可以在 http://msdn.microsoft上找到对此的引用. com/en-us/library/tbze79kd%28v = vs.80%29.aspx [
You can find a reference to this at http://msdn.microsoft.com/en-us/library/tbze79kd%28v=vs.80%29.aspx[^] well.
您是说要把css文件放在一个在App_Theme文件夹下名为AADefault的子文件夹中,完成此操作后,您需要告诉您的网页哪个文件夹保存了css文件,因此您需要在web.config中编写以下代码:-
you are saying that you are putting your css file inside a subfolder called AADefault under App_Theme folder, After doing this you need to tell your webpages that which folder is holding the css file so you need to write following code in web.config:-
<pages theme="AADefault">
</pages>
其中,AADefault是您的文件夹名称,其中包含您的css文件.
这就是您需要做的.
祝你好运.
where AADefault is your folder name which containing your css file.
this is all you need to do.
Good luck.
这篇关于CSS在vs2010 Web项目中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!