bootstrap
<!doctype?html> <html> <head> ????<meta?charset="UTF-8"> <title>基礎表單</title> <link?rel="stylesheet"?> </head> <body> <form?role="form"> ??<div> ????<label?for="exampleInputEmail1">郵箱:</label> ????<input?type="email"?id="exampleInputEmail1"?placeholder="請輸入您的郵箱地址"> ??</div> ??<div> ????<label?for="exampleInputPassword1">密碼</label> ????<input?type="password"?id="exampleInputPassword1"?placeholder="請輸入您的郵箱密碼"> ??</div> ??<div> ????<label> ??????<input?type="checkbox">?記住密碼?</input> ????</label> ??</div> ??<button?type="submit"?class="btn?btn-default">進入郵箱</button> </form> </body> </html>
為什么這里的<input>標簽不需要有對應的</input>?有點反h5吧?
2017-03-13
在HTML規范中,單獨存在的標簽是不需要使用/來自我關閉的,比如<br>,<input>,<hr>等等這樣的標簽都是符合語法的.
在XHTML規范中,單獨存在的標簽要按照XML的語法規則進行自我關閉,上面三個標簽就應寫成<br />,<input />,<hr />
由于你這段代碼第一行的文檔聲明為html,也就不需要對單獨存在的標簽進行自我關閉了.
2017-03-13
HTML里獨立標簽原本是沒有關閉符號的,加個關閉符號效果上沒什么影響,只是為了考慮到向后兼容及與其他語言的兼容,關閉掉顯得更嚴謹。而且當有大量標簽的時候,更方便之后的查閱和他人理解。