簡體   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