asp.net - Asp.net 输入类型 =“文本”与 asp:textbox
问题描述
我是新的 Asp.Net。我有 input type="text" 我也有用于 input[type="text"] 的 css 类。所以我有一个asp:文本框。如何为我的 asp:textbox 编写 css 类,这是一个与输入不同的 css 类?
我的 asp:textbox 从 .login-box input[type=text], input[type=password] 获取属性
<div class="login-box" style="padding:70px 30px">
<img src="Images\human.png" class="man"/>
<h1>Login Here</h1>
<p>Username</p>
<input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
<p>Password</p>
<input type="password" name="password" placeholder="Enter Password"/>
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
<asp:TextBox ID="txtError" CssClass="text-hide" runat="server">Incorrect username or password!</asp:TextBox>
<a href="#">Forgot Password</a>
</div>
我的style.css如下:
.login-box input {
width: 100%;
margin-bottom: 20px;
}
.text-hide {
height:40px;
border-color:Transparent;
background-color:Transparent;
color:Red;
}
.login-box input[type=text], input[type=password] {
height: 40px;
border: 0;
border-bottom: 1px solid #fff;
background-color: transparent;
color: #fff;
font-size: 16px;
outline: none;
}
解决方案
使用 CssClass 属性。像这样:
<asp:TextBox ID="txtError" CssClass="text-hide" runat="server">
这将变成:
<input type="text" class="text-hide">
在页面上
推荐阅读
- spring-boot - 在 Fargete ECS 集群中引用 Docker 容器的环境变量
- mips - 如何将 jr $ra 直接放到正确的位置?
- python - 在 MAC 上安装 anaconda 后无法使用 conda
- ssl - 自签名 https gitlab
- reactjs - 使用 React 在页面上滚动可见
- java - 在java中使用函数式风格有什么好处?
- java - 休眠两级级联不适用于显式清除 Set
- python - 如何在遍历python中的列表时标记编码
- java - ms word的图像在我打开后10秒后消失
- amazon-web-services - 是否可以获得 AWS Cognito 用户密码?