包括h1, form, li, ol, ul, p, pre, table, div等等
<div>元素常常被用来作为其他元素的容器,在结合css样式后,div元素可以来涉及整个代码块的风格。 例子(蓝底白字边缘填充):
<html> <body> <h1>headline</h1> <div style="background-color:green;color:white; padding:20px;"> <p>Some paragraph text goes here</p> <p>Another paragraph goes here</p> </div> </body> </html>包括b, a, strong, img, input, em, span等
span常被作为行内元素的容器,结合css样式,可以设计一部分字符的样式等。 例子(蓝底白字边缘填充):
<html> <body> <h1>headline</h1> some<span style="background-color:green;color:white;">important</span>message </body> </html>form元素常被用于向服务器提交信息。 type包括text, password, radio, checkbox, submit等,radio是多选一,checkbox允许多选,submit提交信息 下面展示一个静态的form,需要结合后端语言如php来处理信息。
<form action="url" method="GET"> <input type="text" name="username" placeholder="Name"><br> <input type="password" name="password" placeholder="Password"><br> <input type="radio" name="gender" value="male">Male<br> <input type="radio" name="gender" value="female">Female<br> <input type="checkbox" name="gender" value="1">Male<br> <input type="checkbox" name="gender" value="2">Female<br> <textarea name="message"></textarea> <input type="submit" name="submit"> </form>