繁体   English   中英

如何在输入标签中设置值的样式?

[英]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">

我认为您希望在按钮上悬停时进行过渡,然后可以使用此链接来了解如何执行此操作。

CSS3-动画文字左/中/右对齐

检查@Bart的答案,您可以执行类似的操作。

对于其他动画和按钮效果,请检查

<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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM