我使用Asp.Net/C#
。目前,我的工作在登錄頁面上,我login page
是不依賴於Master Page
,因此鏈接到Stylesheet
我的頭段已設置CSS樣式表不顯示效果
<link rel="stylesheet" href="Styles/Login.css" type="text/css"/>
的問題是,樣式沒有在我的登錄控件任何efeect 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>
1.檢查CSS文件是否是負載因爲HREF =「樣式/ Login.css」表示該文件的相對路徑。 2。使用調試工具來檢查你的dom頁面上是否有登錄框div – 2012-04-09 06:20:30
哪個瀏覽器?我試圖從你的代碼中創建一個示例,它適用於我。你跑了什麼問題,如顏色不顯示,位置不正確等...請詳細說明。 – AYK 2012-04-09 06:21:29
@AYK ....同意你...代碼對我也有效,可能是問題是由於CHRIS LEE提到的問題... – Usman 2012-04-09 06:23:46