zoukankan      html  css  js  c++  java
  • HTML5与HTML4的区别-----文档结构

    HTML5在结构和语法上做了大量的简化。当然,也提供了语义化的标签  

    结构上区别:

      1.简化了文档声明语句     HTML5仅规定了一种:       <!DOCTYPE html>

      2.简化了设置字符编码   <meta charset="UTF-8">

        charset 属性是 HTML5 中的新属性,且替换了:<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    语法区别:
      1.省略了一些标签:

        全部省略: html   body  head  tbody

            在实际编码中,不建议省略像 html body head元素。一是习惯上无法接受;二是看着别扭

        省略结束标签:

          li     p    ( dl  dt)      (tr   th   td   thead   tbody   tfoot    table表单)         option   

        可以不闭合的空标签:

           br  img  hr   input   link  meta         

      2.具有boolean值属性

        checked  selected  disabled

        HTML5中    <input    type="checkbox"  checked >    或者  <input    type="checkbox"  checked="" />   都是ok的

        HTML4        <input    type="checkbox"  checked="true"   />     <input    type="checkbox"  checked="false"  />    后面的赋值不可以省略

      3.省略引号

        <input    type = radio >       语法上是ok的, 在不考虑兼容的情况下。建议带上引号

      4.忽略大小写

        在HTML5中是忽略大小写的       <INPUT  type="Radio">      引擎是可以正确编译的

    ================完结======================

      (补充上一篇的, 图文混排  HTML5新增了  figure  元素。    功能类似于  dl结构

      figure:     标签规定独立的流内容(图像、图表、照片、代码等等) 

           元素的内容应该与主内容相关,同时元素的位置相对于主内容是独立的。如果被删除,则不应对文档流产生影响。

        <figure>
          <img src="img_pulpit.jpg" tppabs="http://w3schools.com/tags/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
        </figure>

      figcaption:  为figure元素定义标题    

           放在figure元素的第一个或最后一个子元素的位置

      <figure>
        <img src="img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">  
        <figcaption>Fig.1 - A view of the pulpit rock in Norway.</figcaption>
      </figure>

      

      

  • 相关阅读:
    iOS 方便的宏定义
    IOS 推送消息 php做推送服务端
    iOS 7 动画UIDynamicAnimator
    iOS 适配
    ios 实现简单的解析xml网页
    用 MPMoviePlayerController 实现简单的视频下载播放功能
    ios 自定义弹出对话框效果
    ios国外大神
    git学习
    ios 7UI适配方法
  • 原文地址:https://www.cnblogs.com/baota/p/8497103.html
Copyright © 2011-2022 走看看