当我尝试使用 css 添加一些输入字段时
我有一个问题
我不能为某些输入字段制作多个 css
这是我的字段
<input type="text" name="firstName" />
<input type="text" name="lastName" />
CSS 是
input
{
background-image:url('images/fieldBG.gif');
background-repeat:repeat-x;
border: 0px solid;
height:25px;
width:235px;
}
我想用这个 css 制作第一个字段 (firstName)
input
{
background-image:url('images/fieldBG.gif');
background-repeat:repeat-x;
border: 0px solid;
height:25px;
width:235px;
}
第二个 (lastName) 使用这个 css
input
{
background-image:url('images/fieldBG2222.gif');
background-repeat:repeat-x;
border: 0px solid;
height:25px;
width:125px;
}
请帮忙:-)
最佳答案
您可以使用 CSS 按类型设置样式或命名表单元素。
input[type=text] {
//styling
}
input[name=html_name] {
//styling
}
关于html - 如何为特定输入类型文本添加 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10589304/