c# - CSS 样式表不显示效果

标签 c# asp.net css

我正在使用 Asp.Net/C#。目前我在登录页面上工作,我的登录页面不依赖于母版页 ,因此链接到 Stylesheet 我在 head 部分设置了

<link  rel="stylesheet" href="Styles/Login.css" type="text/css"/>

问题是样式对登录页面上的控件没有任何影响。这是我的 css 文件

body
{
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size:75%; 
}
#loginbox
{
     position:fixed;
    background-color:#9cc3f7;
    border:2px solid #ddd;
    height:200px;
    width:300px;
    top:50%;
   margin-left: -130px;
   margin-top: -100px;
    left:50%;
}

这是登录页面

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HomeLogin.aspx.cs" Inherits="CwizBankApp.HomeLogin" %>

<!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>Comwizard Systems | Login</title>
    <link  rel="stylesheet" href="Styles/Login.css" type="text/css"/>

</head>
<body>
    <form id="form1" runat="server">

    <div id="loginbox">
    <span>UserName:</span><asp:TextBox ID="txtUserName" runat="server"></asp:TextBox> <br /> 
    <span style="margin-left:6px;">Password:</span><asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox><br />  
    <asp:Button ID="cmdLogin"  runat="server" Text="Login" onclick="cmdLogin_Click" />

    </div>
    </form>
</body>
</html>

谁能帮我解决这个问题。 任何建议都非常感谢。 谢谢

终于问题解决了 在 web.config 中添加这个解决了它

<location path="~/Styles">
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
</location>

最佳答案

试试这个

   <location path="~/stylesheets">
        <system.web>
            <authorization>
                <allow users="*" />
            </authorization>
        </system.web>
   </location>

请用您的样式表路径更新路径....引用这篇文章

http://forums.asp.net/t/1678658.aspx/1

关于c# - CSS 样式表不显示效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10069624/

相关文章:

asp.net - 当使用 Session 是件坏事时,它有什么问题呢?

javascript - 在 HTML JavaScript 中向输出添加文本

javascript - 如何使用 html、css、bootstrap 在下拉列表中创建事件元素

javascript - 粉碎一个元素,向随机方向发送碎片

c# - 是否可以让一个应用程序配置和管理 DirectShow 过滤器,但将输出引脚绑定(bind)到另一个应用程序?

c# - 将一个可观察值与另一个可观察值的最新值相结合

c# - try-catch 在 IL 中如何工作?

c# - 在后面的代码中,我如何使验证器不验证?

javascript - 使用 Javascript 清空 FileUpload 文本

javascript - 从 aspx 页面中提取 svg 元素的代码?