c# - CSS 在设计 View 中显示而不是在运行时

标签 c# asp.net .net css visual-studio-2010

我有一个基于母版页的网站,该网站具有菜单功能。成功从 Style.css 文件中读取 CSS。我现在添加了一个单独的 Login.aspx 页面,它运行良好,但没有获取 Account.css 文件,该文件具有登录页面的特定 css。我不希望登录页面引用母版页。

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"      type="text/javascript"></script>
    <link href="Account.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {
                 $('.grid_12').fadeIn(1750);
        });
    </script>
</head>

我将不胜感激任何见解,因为我已尝试以我能想到的所有方式引用 Account.css 文件路径:

href="./Account.css"
href="Account.css"
href="~/Account.css"

我现在已将 Login.aspx 页面和 Account.css 文件放在网站根目录下的新登录文件夹中。

最佳答案

您可能有一个区域正在使用表单例份验证。
如果是那么你可以使用

 <location path="Account.css">
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
</location>

内部

<appSettings></appSettings>

否则你可以使用

<style type="text/css" src='<%= ResolveUrl("Account.css")%>'></script>

关于c# - CSS 在设计 View 中显示而不是在运行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13306013/

相关文章:

c# - 在 C# 中用 32 位字交换字节序的更快方法

c# - 具体解析XML成数组

c# - 如何使用事件处理程序将数据从一种形式传输到另一种形式

asp.net - 脚本管理器控件实际上有什么作用?

c# - 如何从这个字符串中获取日期?

c# - OAuth 2.0 授权服务器

c# - 使用正则表达式时过滤掉不匹配的字符

JavaScript onclick : how to pass the event variable?

c# - 从 wpf 中检索 gridview 选定行中的值

c# - 表达式与 Lambda