form表單:css
form必須屬性:action,指定一個服務器地址。html
若但願表單中的數據發送給服務器,必須設置name屬性。瀏覽器
用戶填寫的信息,將會追加在url地址?後面,以查詢字符串的形式發送給服務器,以「&」隔開。服務器
網頁用表單來向服務器提交信息。url
最多見的百度一下:spa
鍵入關鍵字,點擊搜索,3d
瀏覽器將關鍵字經過表單提交到服務器,code
服務器處理表單數據,並響應。orm
簡單的表單實例:htm
html代碼:
<!doctype html> <html> <head> <meta charset="utf-8" /> <title>表格</title> <link rel="stylesheet" type="text/css" href="css/form.css" /> </head> <body> Hello Web!` <br /> form 是<b>塊元素</b>,獨佔一行。 <div > <form action="deal.html" id="userregist" > <!-- 文本框 --> 用 戶 名 : <input type="text" name="username" value="" /><br /> <!-- 密碼框 --> 請設置密碼: <input type="password" name="userpassword1" value=""/><br /> 再輸入密碼: <input type="password" name="userpassword2" value=""/><br /> <!-- 單選按鈕 --> 性 別: <input type="radio" name="usersex" value="boy" />男 <input type="radio" name="usersex" value="girl" />女<br /> <input type="submit" value="立刻註冊" id="submituser" /><br /> </form> </div> </body> </html>
css代碼:
@charset "utf-8"; *{ margin: 0px; padding: 0px; } .clearfix { zoom:1; } .clearfix:before, .clearfix:after { content:""; display: table; clear: both; } body{ background-color: #3e4e54; } #userregist{ width: 500px; margin: 0px auto; } #submituser { margin: 25px 0px 0px 152px; }