我正在使用Asp.Net/C#.Currently我正在处理登录页面,我的login page不依赖于Master Page,因此我在标题部分设置了指向Stylesheet的链接
<link  rel="stylesheet" href="Styles/Login.css" type="text/css"/>问题是样式对我的控件没有任何影响,登录page.Here是我的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>发布于 2012-04-09 14:49:11
尝尝这个
   <location path="~/stylesheets">
        <system.web>
            <authorization>
                <allow users="*" />
            </authorization>
        </system.web>
   </location>请使用本文的样式表path....Refer更新路径
http://forums.asp.net/t/1678658.aspx/1
发布于 2012-04-09 14:20:17
快速问一下,你能检查一下css文件是否被解析了吗?
如果您使用的是chorme,您可以使用开发人员工具,并使用网络部分来查看所有通过的请求。
如果您使用的是firefox,请使用firebug进行同样的操作。
谢谢
发布于 2012-04-09 14:24:07
试一试
href="@Url.Content("~/Styles/Login.css")"而不是
href="Styles/Login.css"如果您使用的是Visual Studio,intellisense (自动完成)将支持您查找确切的位置。只需在打开Url.Content()方法的括号后按Ctrl+Space即可。
https://stackoverflow.com/questions/10069624
复制相似问题