html注意要点

html

  1. 请始终将正斜杠添加到子文件夹。一般情况,依赖服务器配置。
    1. 主要问了区分访问的是文件还是文件夹,比如访问路径为http://www.a.com/b浏览器不知道访问的是文件还是文件夹,会先访问一遍确认是那种类型,如果是文件夹则会加上/,重新访问地址为http://www.a.com/b/的路径。
    2. 如果带后缀名http://www.a.com/b.html可以明确知道访问的是文件,不需要再次请求。
  2. 每30秒钟刷新当前页面:
    <meta http-equiv="refresh" content="30">
  3. 30秒后跳转到百度:
    <meta http-equiv="refresh" content="30" url="http://www.baidu.com">
  4. 图片映射:给图片某些区域添加热区

    <img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">
    <map name="planetmap">
    <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm">
    <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">
    <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
    </map>
  5. 有序列表<ol>可定义type来设置不同的序号
    1. <ol type="A"><li>a</li><li>b</li></ol>
      1. a
      2. b
    2. <ol type="1" start="5"><li>a</li><li>b</li></ol>
      1. a
      2. b
    3. <ol type="I"><li>a</li><li>b</li></ol>
      1. a
      2. b
  6. <pre> 可保留文本原格式,而不主动删除空格及空行。
  7. 判断是否支持js或js是否被禁用:
    <noscript>抱歉,你的浏览器不支持 JavaScript!</noscript>
  8. 字符实体,大小写敏感:http://www.runoob.com/tags/ref-entities.html

html5

  1. MathML 可利用MathML编辑器进行辅助。http://tool.oschina.net/mathml
  2. 拖放
  3. 视频<video>
  4. 音频<audio>
  5. 新的 Input 类型,目前主流浏览器很少全部支持
  6. Server-Sent 事件 - 单向消息传递,本质下载

    if(typeof(EventSource)!=="undefined"){
    var source=new EventSource("demo_sse.php");
    source.onmessage=function(event){
    document.getElementById("result").innerHTML+=event.data + "<br>";
    };
    }else{
    document.getElementById("result").innerHTML="抱歉,你的浏览器不支持 server-sent 事件...";
    }

猜你喜欢

转载自blog.csdn.net/vadonmo/article/details/79402836