w3g提供在线校验页面:http://validator.w3.org/
1.文本框获取焦点
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html"> <html> <head> <base href="<%=basePath%>"> <title>HTML5</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <!-- 标签mark用于强调被标记的文本 --> <mark>当前时间:</mark> <!-- 标签time只是增强语义,跟直接用div一样的效果 --> <time><b>2014-03-15<b/></time> <br/><br/> <!-- 文本框获取输入焦点 --> 图书:<input type="text" name="book" id="book" autofocus/><br/><br/> 价格:<input type="text" name="price" id="price" value="30.82"/><br/><br/> <!-- img,input,br,hr都是空元素,不需要结束标签 ,其中request.getContextPath()是获取webroot路径--> 封面:<img src="<%=request.getContextPath()%>/image/book.jpg"/><br/><br/> 简介:<area id="content" value="这本书不错"/> </body> </html>
2.文本格式化标签
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 <% 3 String path = request.getContextPath(); 4 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 %> 6 <!DOCTYPE html"> 7 <html> 8 <head> 9 <base href="<%=basePath%>"> 10 <title>文本格式化标签</title> 11 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 12 </head> 13 <body> 14 <span><b>加粗字体</b></span><br/> 15 <span><i>斜体字体</i></span><br/> 16 <span><em>强调字体</em></span><br/> 17 <span><big>大字号字体</big></span><br/> 18 <span><small>小字号字体</small></span><br/> 19 <!-- sup:上标字体 --> 20 <span>2<sup>3</sup>=8</span><br/> 21 <!-- sub:下标字体 --> 22 <span>2<sub>3</sub></span><br/> 23 <div><bdo dir="ltr">从左往右</bdo></div> 24 <div><bdo dir="rtl">左往右从</bdo></div> 25 </body> 26 </html>