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