【发布时间】:2018-01-02 16:29:31
【问题描述】:
我正在为我的网络应用程序使用以下 HTML 和 CSS 设计 - https://codepen.io/andytran/pen/PwoQgO
我需要将按钮标签<button>Login</button>替换为以下内容,
<asp:Button ID="bnLogin" runat="server" Text="Login" OnClick="bnLogin_Click" />
问题是当我使用 asp:Button 元素而不是 button 元素时,我失去了 CSS 样式。
这里是对应的 HTML -
<div class="form">
<h2>Login to your account</h2>
<form id="form1" runat="server">
<asp:TextBox ID="txtUserID" runat="server" Columns="50" placeholder="User ID" ></asp:TextBox>
<asp:TextBox ID="txtUserPassword" runat="server" Columns="50" TextMode="Password" placeholder="Password"></asp:TextBox>
<asp:Button ID="bnLogin" runat="server" Text="Login" OnClick="bnLogin_Click" />
<br />
<asp:Label ID="lblMsg" ForeColor="red" runat="server" />
</form>
</div>
以及对应的CSS——
.form-module button {
cursor: pointer;
background: #33b5e5;
width: 100%;
border: 0;
padding: 10px 15px;
color: #ffffff;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.form-module button:hover {
background: #178ab4;
}
【问题讨论】: