如何使用控制知道css类ASP.NET
-
09-06-2019 - |
题
由于没有头部分的用户控制asp.net用户控制没有办法知道有关的样式表文件。所以css类中的用户的控制不承认通过视工作室和生产的警告。我怎么可以做一个用户控制知道,这将涉及css类,因此,如果这是警告我关于非现有的css类,这意味着这类真的不存在吗?
编辑:或者我应该去一个不同的设计喜欢露出css类属性(如"HeaderStyle-CssClass"的内?
解决方案
这是我做了什么:
<link rel="Stylesheet" type="text/css" href="Stylesheet.css" id="style" runat="server" visible="false" />
它傻瓜Visual Studio以为你已经增加了一个样式表中的页面,但它没有得到提供。
这是一个甚至更简洁的方式来做这个有多个参考资料;
<% if (false) { %>
<link rel="Stylesheet" type="text/css" href="Stylesheet.css" />
<script type="text/javascript" src="js/jquery-1.2.6.js" />
<% } %>
可以看到 这篇文章 从菲尔*哈克.
其他提示
添加的风格你的用户控件和进口css。
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="WCReportCalendar.ascx.vb"
Inherits="Intra.WCReportCalender" %>
<style type='text/css'>
@import url("path of file.css");
// This is how i used jqueryui css
@import url("http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css");
</style>
your html
你可以使用 CSS
直在 userControl
.
使用这个 UserControl
:
<head>
<title></title>
<style type="text/css">
.wrapper {
margin: 0 auto -142px;
/* the bottom margin is the negative value of the footer's height */
}
</style>
</head>
这将工作。
不隶属于 StackOverflow