form action= /path/to/script id= thisform method= post p label for= name Name: /label br / input type= text id= name name= name / /p p label for= email Email: /label br / input type= text id= email name= email / /p p input type= submit value= submit / /p /form
我喜歡方法C的幾個地方.首先,對于類似本示例的單純表單來說,我發現把每個說明與表單元素放在單獨的段落比較方便,不加上樣式顯示時,段落之間的預設距離應該足以讓你輕松閱讀內容.稍后我們還能以CSS為表單內包含的 p 標簽設定間隔. 我們甚至更進一步,為表單設定了唯一的id= thisform .因此,剛才我提到的精確間隔大致上可以寫成這樣:
form action= /path/to/script id= thisform method= post p label for= name Name: /label br / input type= text id= name name= name / /p p label for= email Email: /label br / input type= text id= email name= email / /p p input type= submit value= submit / /p /form