[英]How to style the value atrribute in the input tag?
我的输入类型是按钮,我想自定义value属性的样式并将其向左移动一点。 也有其他输入按钮。 我只想将样式应用于此输入按钮。 这是代码:
<input style="width:85px;margin-left:-5px" type="button" value="Discuss"
onclick="location.href=''" name="sub" class="button-add mebutton">
<input type="button" value="Discuss"
onclick="location.href=''" name="sub" class="button-add mebutton">
在css中添加
<style>
input[type=button]
{
margin-left:10px;
width:85px;
}
</style>
删除内联样式,并从添加了mebutton
的类中应用样式。 如果您认为mebutton类添加了所有位置,请为此按钮添加一些新类并应用它。 使用text-align
属性可以使文本左/右对齐,并在文本位置使用填充。
.mebutton {
width:85px;
text-align:left;
padding-left:10px;
}
我在以下代码段中添加了相同的内容。
.mebutton { width:85px; text-align:left; padding-left:10px; }
<input type="button" value="Discuss" onclick="location.href=''" name="sub" class="button-add mebutton">
<input class="btnstyle" type="button" value="Discuss" onclick="location.href=''" name="sub">
添加这个CSS
<style>
.btnstyle {颜色:蓝色; font-size:24px;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.