サイト内検索

...スタイルシート(css)...

スタイルシート・フォーム

フィールドセットの背景色

フィールドセットの背景色は、フォーム(form要素)のfieldset要素に
background-colorプロパティを指定します。
[使い方]
fieldset{
background-color: #888888;
}
[メモ]
fieldset要素については、こちらをご覧ください。
marginについては、こちらをご覧ください。
paddingについては、こちらをご覧ください。
プロパティ名 説明
background-color ; 16進数RGB値(例・・#fff000)
または
カラーネーム(例・・red)を指定します。
transparent;初期値
「透明」を指定したことになります。

サンプル

[headの中]

<style type="text/css">
<!--
legend{
background-color: #ccff99;
}
fieldset {
width: 450px;
margin-bottom: 20px;
padding-top: 10px;
padding-bottom: 10px;
background-color: 4px #ccff99 dashed;
}
fieldset input {
width: 250px;
}
-->
</style>

[bodyの中]

<form method="post" action="sample.cgi">
<fieldset>
<legend> ユーザー登録<legend>
ニックネーム:<input type="text" name="user" size="20">
パスワード:<input type="text" name="pass" size="20">
e-mail:<input type="text" name="email" size="70">
</fieldset>
<fieldset>
<legend>登録内容</legend>
お名前:<input type="text" name="name" size="20">
ご住所:<input type="text" name="address" size="70">
電話番号:<input type="text" name="tel" size="20">
</fieldset>
<div class="sample-1">
<input type="submit" value="登録する">
</div>
<div class="sample-2">
<input type="reset" value="リセット">
</div>
</form>

[ブラウザ上]

ユーザー登録
ニックネーム:

パスワード:

e-mail:
登録内容
お名前:

ご住所:

電話番号:
←サンプル(登録できません。)

Copyright c 2007.10.01 luc All rights reserved.