国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 網頁設計 > 正文

網頁設計之5種簡單的XHTML網頁表單

2024-08-30 08:32:51
字體:
來源:轉載
供稿:網友

技術1:標簽三明治

將輸入框,選擇框和文本框全部包含進 label 元素,并全部設置為塊級元素。將單選按鈕和多選框顯示方式設置為 inline 以便于它們在同一行出現。如果你比較喜歡 label 和單選按鈕/多選框出現在不同行,可以選擇不把它包含在 label 里面,或者使用硬換行處理。
每種情況都在下面展示了。

當這些看起來比較時髦的時候,w3c 事實上已經含蓄地展示了他們的 label 例子。

主要好處:簡單

代碼:

label, input, select, textarea {display: block;}label {margin-bottom: 10px;}input[type="radio"], input[type="checkbox"] {display: inline;}<form> <fieldset><legend>contact form</legend><label for="name">name</label><input id="name" name="name" size="20" /><label for="email">email</label><input id="email" name="email" size="20" /><label for=" choices"> choices (radio) — <em>wrapped label</em></label><input name=" choice" type="radio" /> choice 1<input name=" choice" type="radio" /> choice 2<input name=" choice" type="radio" /> choice 3<label style="margin-bottom: 0pt;" for=" choices2"> choices (checkbox) — <em>non-wrapped label, margin reset</em></label><input name=" choice2" type="checkbox" /> choice 1<input name=" choice2" type="checkbox" /> choice 2<input name=" choice2" type="checkbox" /> choice 3<div style="height: 10px;"><!-- just to split the demo up --></div><label for=" choices3"> choices (checkbox) — <em>wrapped, hard line-break</em></label><input name=" choice3" type="checkbox" /> choice 1<input name=" choice3" type="checkbox" /> choice 2<input name=" choice3" type="checkbox" /> choice 3<label for="dropdown">question</label><select id="dropdown"> <optgroup label="group of options"></optgroup> <option>option 1</option> <option>option 2</option> <option>option 3</option> </select><label for="message">message<textarea cols="36" rows="12" name="message"></textarea></label><input type="submit" value="send it" /></fieldset></form>

運行結果


contact form

 

 

 

choice 1

 

choice 2

 

choice 3

 

choice 1

 

choice 2

 

choice 3

 

choice 1

 

choice 2

 

choice 3

 

 


技術2:懶人

許多開發者采用了這種不正統但是快速簡單(用換行隔斷標記)的方法。雖然能運行,但是對你的 css 能力有害,因為你不需要任何 css 去實現它。

主要好處:快速
代碼:

<form> <fieldset><legend>contact form</legend><label for="name">name</label><input id="name" name="name" size="20" /> <label for="email">email</label><input id="email" name="email" size="20" /> <label for=" choices"> choices (radio)</label><input name=" choice" type="radio" /> choice 1<input name=" choice" type="radio" /> choice 2<input name=" choice" type="radio" /> choice 3<label for=" choices3"> choices (checkbox)</label><input name=" choice3" type="checkbox" /> choice 1<input name=" choice3" type="checkbox" /> choice 2<input name=" choice3" type="checkbox" /> choice 3<label for="dropdown">question</label><select id="dropdown"> <optgroup label="group of options"></optgroup> <option>option 1</option> <option>option 2</option> <option>option 3</option> </select><label for="message">message</label><textarea cols="36" rows="12" name="message"></textarea><input type="submit" value="send it" /></fieldset></form>

運行結果


contact form

 

 

 

choice 1

 

choice 2

 

choice 3

 

choice 1

 

choice 2

 

choice 3

 


 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 安泽县| 赞皇县| 卢龙县| 莱芜市| 苏州市| 琼海市| 涟水县| 石阡县| 呼玛县| 泰安市| 文昌市| 虹口区| 彭州市| 南召县| 辉县市| 鸡泽县| 曲靖市| 兰考县| 漾濞| 武陟县| 财经| 济宁市| 江津市| 千阳县| 和平区| 肇源县| 亳州市| 黄平县| 田阳县| 东兰县| 金坛市| 屏东市| 轮台县| 双流县| 南涧| 晋宁县| 神木县| 伊春市| 东光县| 白山市| 青海省|