走向一條通往JAVA的不歸路...
雖然經常接觸HTML,不過有些標簽以前卻從沒引起我的注意。但是其中幾個Tag的確比較有用,而且是符合W3C XHTML標準的。
1. Label
Label是用來標記Input元素的提示的。例如:
<label for="id_name">Name</label><br /><input type="text" name="name" id="id_name" size="20"/>
Label的“For”屬性要和Input元素的ID相一致。
好處:點擊提示文字,就自動Focus對應的輸入元素。對于Radio,Checkbox這類點擊區域特別小的控件特別有用:Color:<br /><input type="checkbox"? name="color" id="color_r" value="red"><label for="color_r"> red</label><br><input type="checkbox"? name="color" id="color_g" value="green"><label for="color_g"> green</label><br><input type="checkbox"? name="color" id="color_b" value="blue"><label for="color_x"> blue</label><br><!--如果For和ID不匹配,點擊文字是沒有用的-->?red?green?blue?
2. FieldSet & Legend
FieldSet用來明確把一組Input控件歸成一組(相當于VB/VC里面的Group控件),而Legend則是組的標題(相當于Group控件的標題)。 例如:
<fieldset style="width:20%">? <legend>Person</legend>? <label for="name">Name</label><input type="text" id="name" />? <fieldset>??? <legend>Gender</legend>??? <input type="radio" name="gender" id="male" /><label for="male">Male</label><br>??? <input type="radio" name="gender" id="female" /><label for="female">Female</label>? </fieldset></fieldset>
3. Optgroup
用于Select里面的option的分組。例如:
<select name="age">? <optgroup label="baby">??? <option>0-2</option>??? <option>3-5</option>? </optgroup>? <optgroup label="kid">??? <option>6-10</option>??? <option>10-15</option>? </optgroup>? <optgroup label="adult">??? <option>16-30</option>??? <option>31-40</option>??? <option>41-60</option>? </optgroup></select>
0-2 3-5 6-10 10-15 16-30 31-40 41-60
http://blog.aspcool.com/zephyr/archive/2005/05/27/2385.html
Powered by: BlogJava Copyright © java_蟈蟈