简体   繁体   English

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

[英]How to style the value atrribute in the input tag?

My input type is a button and I want to customize the style of the value attribute and want to move it a little to the left. 我的输入类型是按钮,我想自定义value属性的样式并将其向左移动一点。 Also there are other input buttons as well. 也有其他输入按钮。 I want to apply the style only to this input button. 我只想将样式应用于此输入按钮。 Here is the code: 这是代码:

<input  style="width:85px;margin-left:-5px" type="button" value="Discuss" 
 onclick="location.href=''" name="sub" class="button-add  mebutton">

I think you want transition on hover of a button then you can use this link to get an idea of how to do that. 我认为您希望在按钮上悬停时进行过渡,然后可以使用此链接来了解如何执行此操作。

CSS3 - animate text align left/center/right CSS3-动画文字左/中/右对齐

check the answer of @Bart you can do something like that. 检查@Bart的答案,您可以执行类似的操作。

for other animation and effects of button check this 对于其他动画和按钮效果,请检查

<input type="button" value="Discuss" 
 onclick="location.href=''" name="sub" class="button-add  mebutton">   

add this in css 在css中添加

<style>
        input[type=button]
                         {
                            margin-left:10px;
                            width:85px;
                          }
    </style>

Remove the inline styles and apply the styles from the class you have added mebutton . 删除内联样式,并从添加了mebutton的类中应用样式。 If you think the mebutton class added all the places, then add some new class for this button and apply it. 如果您认为mebutton类添加了所有位置,请为此按钮添加一些新类并应用它。 Use text-align property to align your text left/right and use the padding for the position of the text. 使用text-align属性可以使文本左/右对齐,并在文本位置使用填充。

.mebutton {
   width:85px;
   text-align:left;
   padding-left:10px;
}

Same I have added in the following snippet. 我在以下代码段中添加了相同的内容。

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

add this css 添加这个CSS

<style>

.btnstyle { color: blue; .btnstyle {颜色:蓝色; font-size : 24px;} font-size:24px;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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