Html 如何将文本框中的字符集绘制成文本框图2效果?
谁能帮我修改CSS代码来完成图1到图2的效果,我想把图中的文本框设置为图2的样式,我应该如何修改CSS代码。 下面是一个CSS和HTML代码Html 如何将文本框中的字符集绘制成文本框图2效果?,html,css,input,Html,Css,Input,谁能帮我修改CSS代码来完成图1到图2的效果,我想把图中的文本框设置为图2的样式,我应该如何修改CSS代码。 下面是一个CSS和HTML代码 .username{ margin-top: 10px; width: 280px; height:48px; background-color: green; } .blanline{ width: 280px; height:23px;
.username{
margin-top: 10px;
width: 280px;
height:48px;
background-color: green;
}
.blanline{
width: 280px;
height:23px;
background-color: #F0FFFF;
}
.password{
width: 280px;
height:48px;
background-color: green;
}
div input,button{
width: 100%;
height: 100%;
font-size: 25px;
}
<div class="username">
<input type="text" id="username" name="username">
</div>
<div class="blanline"></div>
<div class="password">
<input type="password" id="password" name="password">
</div>
.username{
边缘顶部:10px;
宽度:280px;
高度:48px;
背景颜色:绿色;
}
布兰琳先生{
宽度:280px;
高度:23px;
背景色:#F0FFFF;
}
.密码{
宽度:280px;
高度:48px;
背景颜色:绿色;
}
div输入,按钮{
宽度:100%;
身高:100%;
字体大小:25px;
}
谁能帮我,我会帮你的。我想你只是在问一个
占位符的问题。
:
HTML代码:
<div class="username">
<input type="text" id="username" name="username" placeholder="Name">
</div>
<div class="blanline"></div>
<input type="password" id="password" name="password" placeholder="Password">
</div>
您应该在
输入
标记中添加一个占位符
<input type="text" id="username" name="username" placeholder="text here">
<input type="password" id="password" name="password" placeholder="text here>
有两种可能的方法:
1.您可以使用HTML5占位符属性:
<input type="text" placeholder="Placeholder text." />
第二种可能不适用于所有浏览器,最好先用第一种。无法理解您的问题。你想在输入中添加一些默认文本吗?你在使用HTML5吗?你想要占位符字符串,对吗?
.username{
margin-top: 10px;
width: 280px;
height:48px;
background-color: green;
}
.blanline{
width: 280px;
height:23px;
}
.password{
width: 280px;
height:48px;
background-color: green;
}
div input,button{
width: 100%;
height: 100%;
font-size: 25px;
}
<input type="text" id="username" name="username" placeholder="text here">
<input type="password" id="password" name="password" placeholder="text here>
<input type="text" placeholder="Placeholder text." />
#username::-webkit-input-placeholder::before {
color:#666;
content:"Username";
}
#password::-webkit-input-placeholder::before {
color:#666;
content:"Password";
}