同様のクラスを与えてから、CSS を使用してスタイルを設定します。
作業例:
<html><head>
<style type='text/css'>
input.small {
width:10px; /* Apply to input tags with class "small" */
}
</style>
</head><body><form>
<input id="total" type="text" name="total" value="" readonly="readonly" />
<input class='small' type="button" value="=" onclick="total.value=getTotalB(this.form)" />
<input class='small' type="reset" onClick="reset()" value="-"/>
</form></body></html>
そうすれば、両方のボタンを同時に変更することができ、見た目も同じになります (一貫性を保つことをお勧めします)。
それらを楽しんでください:
<style type='text/css'>
input.small {
border:1px solid #ccc;
cursor:pointer;
padding:0;
text-align:center;
width:10px;
}
input.small:hover {
background:dodgerblue;
}
</style>
ちなみに、 の問題style="width"
は、ボタンに「 で自分をスタイルする 」と伝えていることですwidth
。
ボタンには、「いくらwidth
ですか?わかりません。通常の方法で行います」と表示されています。
これを修正するには、幅を指定する必要がありstyle="width:10px;"
ます。これで満足のいくボタンができました。