search
HomeWeb Front-endH5 TutorialNotes organized by h5

Notes organized by h5

Apr 11, 2017 pm 02:38 PM

tag

UpdateSemantictag

    header标签
    nav标签
    section标签
    article标签
    aside标签
    widget标签
    footer标签

Why there are semantic tags

能够便于开发者阅读和写出更优雅的代码,代码如诗
同时让浏览器或是网络爬虫可以很好地解析,从而更好分析其中的内容
更好地搜索引擎优化

切记:HTML的职责是描述一块内容是什么(或其意义)而不是它长的什么样子,它的外观应该由CSS来决定。

Application tag

[datalist(data list)]

datalist The presentation of the data list requires a carrier

            <input>
            <datalist>
                <option></option>
                <option></option>
            </datalist>

            <input>
            <datalist>
                <option></option>
                <option></option>
            </datalist>

[progress (Progress bar)]

To change its style, you need to first change -webkit- appearanceSet to none

            <style>
                .my_progress{
                    -webkit-appearance:none;
                }
                .my-progress::-webkit-progress-bar{
                    //样式
                }
            </style>
            <progress></progress>

[meter (numeric display)]

Very few browsers support

            <meter></meter>

The maximum and minimum values ​​of the display: max, min
The maximum and minimum values ​​that the display can reach: high, low
The best value of the measurement range of the display: optimal
The current value displayed by the display: value

Firefox compatible

[details]

Click on a content to expand the panel, compatible with Firefox and Google

Properties

Common link relationship table

    alternate       文档的可选版本(例如打印页、翻译页或镜像)
    stylesheet      文档的外部样式表
    start           集合中的第一个文档
    next            集合中的下一个文档
    prev            集合中的前一个文档
    contents        文档目录
    index           文档索引
    glossary        文档中所用字词的术语表或解释
    copyright       包含版权信息的文档
    chapter         文档的章
    section         文档的节
    subsection      文档的子段
    appendix        文档附录
    help            帮助文档
    bookmark        相关文档
    nofollow        用于指定 Google 搜索引擎不要跟踪链接
    licence         一般用于文献,表示许可证的含义
    tag             标签集合
    friend          友情链接


    案例

    <link>
    <link>
    <a>上一页</a>
    <a>下一页</a>

    <link>
    <link>
    <link>
    <link>
    <link>

    <a>old posts</a>
    <a>tutorial</a>
    <a>license</a>
    <a>wannabe</a>
    <a>games posts</a>

Structured data tag

Advanced stuff, currently only supported by Google
is to make it easy to crawl the data on the webpage

<p>
      </p><p>我叫
        <span>汪磊</span>。
      </p>
      <p>我养了一条叫
        <span>旺财</span>的
        <span>金毛</span>犬。
      </p>


        比如抓取出:
        主人:汪磊
        狗名:旺财
        品种:金毛

ARIA

####Accessible Rich Internet Application (无障碍富互联网应用程序)
    主要针对于屏幕阅读设备(e.g. NVDA),更快更好地理解网页
    不仅仅是为了盲人用户,更多语义化
1.数据注解,类似lable,只不过label是针对表格
2.可以通过aria知道数据的强相关

aria由一套属性组成,属性分为role以及对应的states和properties,
aria将html元素分为六种role,每种有对应的states和properties,
但有一些是共用的,比如

        aria-atomic
        aria-busy(state)
        aria-describedby
        aria-disabled(state)
        aria-dropeffect
        aria-flowto
        aria-haspopup
        aria-hidden(state)
        aria-invalid(state)
        aria-label
        aria-labelledby
        aria-owns
        aria-relevant

        举个伪元素例子,

        <p>单选tabindex="0"</p>

        这个p模拟了radio的功能,在平时读屏软件是分辨不出来的,
        但是加上role及aria-checked状态,
        在读屏软件(NVDA)中读出来就是:

单选2 单选按钮 选中 第1页 共1项

For detailed attributes, see: ARIA Tenpay Design Center.html

Custom attribute data

通过DOM存储与DOM对象强相关的数据

1.可以给html里的所有dom对象都可以添加一些data-xxx的属性
2.用来记录与当前DOM强相关的数据

      
  • 张三
  •   
  • 李四
  •   
  • 王二

Case 1:





    ##

            <script>
            //键是ID 值是信息
                var data = {
                    01:{
                        name:"伟哥哥",
                        age:"18"
                    },
                    02:{
                        name:"伟哥哥",
                        age:"19"
                    },
                    03:{
                        name:"伟哥哥",
                        age:"20"
                    }
    
                    //jQuery操作一定要做变量本地化
                    var list = document.getElementById("list");
                    for(var id in data){
                        var item = data[id];
                        var liElement = document.createElement("li");
                        //liElement.innerHTML = item.name;
                        liElement.appendChild(document.createTextNode(item.name));
                        liElement.setAttribute("data-age",item.age);
                        liElement.setAttribute("data-id",item.id);
                        list.appendChild(liElement);//变量本地化
    
                        //此处才将元素加到界面上
                        liElement.addEventListener("click",function(){
                            //alert(this.name);
                            //this 是当前点击的元素
                            //alert(this.getAttribute("data-age"));
                            console.log(this.dataset["age"]);
                        })
                    }
    
                };
            </script>
    Case 2:

            
                
                      
    •                     张三                     
      
                      
    •                 
    •                   李四                     
      
                      
    •                 
    •                   王二                   
      
                      
    •             
                     <script> var ul = document.getElementById(&#39;users&#39;); for (var i = 0; i < ul.children.length; i++) { var li = ul.children[i]; // JS 添加data属性 i.setAttribute(&#39;data-name&#39;, li.innerText); i.children[0].innerText = &#39;&#39;; or (var key in li.dataset) { li.children[0].innerText += key + &#39;:&#39; + li.dataset[key] + &#39;\n&#39;; } } </script>Case 3:

                
                    <p>
                        </p>
                              
    • 新闻
    •                         
    • 八卦
    •                         
    • 体育
    •                     
                        

                        

                        

                                     <script> $(function(){ //写这个是为了有一个单独作用于,避免污染 //api是应用程序编程接口 var $lis = $(&#39;.tabs>ul>li&#39;); $lis.on("click",function(){ //获取目标对象的选择器 var targetSelector = $(this).data(&#39;target&#39;); var $target = $(targetSelector); }); }); </script>             Smart form

    New form type

        

            //repuired表示必须的,表示填写框不能为空,会有提示但是提示不能更改                  //只能判断中间是否有@         
            
            //拖动条,可以获得拉到的地方的数字          
            
            
            
            
                 
    Virtual keyboard adaptation

            手机键盘会根据不同的type类型弹出不同键盘类型
            如打开数字键盘,密码键盘,邮件键盘
            <input>
            <input>
            <input>
            <input>
            <input>

    Web page

    Multimedia

    Audio
        多媒体的dom对象有一些新的方法可以去做播放暂停

    Single data source method

    默认界面:
    
            <audio></audio>
    
    自定义一个:
            <audio></audio>
            <button>播放</button>
            <button>暂停</button>
            <script>
            var btn = document.getElementById("btn");
            var btn_pause = document.getElementById("btn_pause");
            var audio = document.getElementById("audio");
            btn.addEventListener("click",function(){
                //播放音频
                audio.play();
            });
            btn_pause.addEventListener("click",function(){
                // 暂停音频
                audio.pause();
            });
            </script>

    Multiple data source method

            <audio>
                <source></source>
            </audio>

    Video

    Single data source method

    <video></video>

    Multiple data source method

            <video>
                 不同浏览器支持格式不一样,因为版权问题
                <source></source>
                <source></source>
                 当浏览器不兼容video标签,就会将他以p方式解析
                 用第三方组件代替
                 <object>
                  <param>
                  <param>
                  <param>
                  <param>
                  <param>
                  <p>
                    </p>
    <p>
                      </p>
    <p><span>您还没有安装flash播放器,请点击<a>这里</a>安装</span></p>
                    
                  
                </object>
            </video>

    Video player related properties

            属性      值           描述
            autoplay    autoplay    如果出现该属性,则视频在就绪后马上播放
            controls    controls    如果出现该属性,则向用户显示控件,比如播放按钮
            height      pixels      设置视频播放器的高度
            loop        loop        如果出现该属性,则当媒介文件完成播放后再次开始播放
            muted       muted       规定视频的音频输出应该被静音。【即:静音】
            poster      URL         规定视频下载时显示的图像,或者在用户点击播放按钮前显示的图像
            preload     preload     如果出现该属性,则视频在页面加载时进行加载,并预备播放
                                    如果使用"autoplay",则忽略该属性
            src         url         要播放的视频的URL
            width       pixels      设置视频播放器的宽度

    Subtitles

        字幕案例:
            <video>
                <source></source>
                <track></track>
            </video>
    
        字幕文件内容示例:
            WEBVIT  FILE
    
            1
            00:00:00.000 --> 00:00:12.000 D:vertical A:start
    
            2
            00:00:12.000 --> 00:00:15.300
            大家好,我是伟哥哥

    Canvas

    2D

    3D (WebGL)

    SVG

    Scalable Vector Graphics Scalable Vector Shape

    svg

    ImageSource: via AI, File-->Script-->Save document as SVG

    svg can be like a tag Paste it directly to the page like that, but we prefer to load it like a picture

    可以借助三个标签载入:
    
            <iframe></iframe>    //推荐
            <object></object>
            <embed>
    
    
    学完ajax之后推荐方式:
    
            学习完异步请求之后,我们可以遍历所有SVG节点,把src引入进来,本身他是一个document对象,可以把它直接append到文档中。
    
            window.addEventListener('load',function(){
                var svgs = document.getElementByTagName('svg');
                for (var i = 0;i </embed>

    Additional:

    1. Sublime server plug-in installation

    Do not stop serber after installation. Directly
    exitsublime, otherwise sublime will crash

    2. Expand the settings in the upper right corner of the Google Chrome developer tools, select show useragent shadow DOM and you can see the virtual The DOM that comes out

    3.

    Pseudo classObject is equivalent to inserting one after weigege, and its style can be changed

    <style>
    .content::after{
        content: &#39;zuishuai&#39;;
        color: #465;
    }
    </style>
    <p>weigege</p>
    4.h5 new tag

    h5 The new tag may not be recognized by low-level browsers because it is too new. The unrecognized tag browser will automatically recognize it as p and load it. The tag can be generated in the following ways
    Method 1: Define it yourself

    Method 2: Introduce the third-party component html5shiv.js
    In it, all h5 new tags are created through method 1

    5. Enter the following code once in the Google console

    1.
    document.body (Enter)
    document.body.contentEditable = true; (Enter)
    Then you can edit the text directly on the page
    2.
    Enter directly at the connection
    data:text/html, (Enter)
    You can edit text directly on the page

    6. Third-party multimedia player library: jwplayer

    7. Specifically for mobile terminals Component used zepto?

    The implemented api is basically the same as jQuery
    Redundant processing and compatible codes have been cut off
    It seems that it can replace jQuery

    8.! important cannot support the inline style in the old version

    9.Markdown

    Open source project description files are written in this way
    Syntax link: http://wowubuntu.com/markdown/
    Use normal text to describe the syntax of rich text
    Extension md, markdown
    Case
    h tag

    HEADER1

    HEADER2

    HEADER3

    Write the paragraph directly without adding anything in front

    • Unordered list

    • There are spaces in front

    1. Ordered list

    2. The numbers in front are all ordered lists, remember to add spaces


    <br/>


    SpecificEditorYou can add javascript to represent specific syntax for writing code

    10.iframe
    It is equivalent to digging a pit to load other pages

    The above is the detailed content of Notes organized by h5. For more information, please follow other related articles on the PHP Chinese website!

    Statement
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Understanding H5: The Meaning and SignificanceUnderstanding H5: The Meaning and SignificanceMay 11, 2025 am 12:19 AM

    H5 is HTML5, the fifth version of HTML. HTML5 improves the expressiveness and interactivity of web pages, introduces new features such as semantic tags, multimedia support, offline storage and Canvas drawing, and promotes the development of Web technology.

    H5: Accessibility and Web Standards ComplianceH5: Accessibility and Web Standards ComplianceMay 10, 2025 am 12:21 AM

    Accessibility and compliance with network standards are essential to the website. 1) Accessibility ensures that all users have equal access to the website, 2) Network standards follow to improve accessibility and consistency of the website, 3) Accessibility requires the use of semantic HTML, keyboard navigation, color contrast and alternative text, 4) Following these principles is not only a moral and legal requirement, but also amplifying user base.

    What is the H5 tag in HTML?What is the H5 tag in HTML?May 09, 2025 am 12:11 AM

    The H5 tag in HTML is a fifth-level title that is used to tag smaller titles or sub-titles. 1) The H5 tag helps refine content hierarchy and improve readability and SEO. 2) Combined with CSS, you can customize the style to enhance the visual effect. 3) Use H5 tags reasonably to avoid abuse and ensure the logical content structure.

    H5 Code: A Beginner's Guide to Web StructureH5 Code: A Beginner's Guide to Web StructureMay 08, 2025 am 12:15 AM

    The methods of building a website in HTML5 include: 1. Use semantic tags to define the web page structure, such as, , etc.; 2. Embed multimedia content, use and tags; 3. Apply advanced functions such as form verification and local storage. Through these steps, you can create a modern web page with clear structure and rich features.

    H5 Code Structure: Organizing Content for ReadabilityH5 Code Structure: Organizing Content for ReadabilityMay 07, 2025 am 12:06 AM

    A reasonable H5 code structure allows the page to stand out among a lot of content. 1) Use semantic labels such as, etc. to organize content to make the structure clear. 2) Control the rendering effect of pages on different devices through CSS layout such as Flexbox or Grid. 3) Implement responsive design to ensure that the page adapts to different screen sizes.

    H5 vs. Older HTML Versions: A ComparisonH5 vs. Older HTML Versions: A ComparisonMay 06, 2025 am 12:09 AM

    The main differences between HTML5 (H5) and older versions of HTML include: 1) H5 introduces semantic tags, 2) supports multimedia content, and 3) provides offline storage functions. H5 enhances the functionality and expressiveness of web pages through new tags and APIs, such as and tags, improving user experience and SEO effects, but need to pay attention to compatibility issues.

    H5 vs. HTML5: Clarifying the Terminology and RelationshipH5 vs. HTML5: Clarifying the Terminology and RelationshipMay 05, 2025 am 12:02 AM

    The difference between H5 and HTML5 is: 1) HTML5 is a web page standard that defines structure and content; 2) H5 is a mobile web application based on HTML5, suitable for rapid development and marketing.

    HTML5 Features: The Core of H5HTML5 Features: The Core of H5May 04, 2025 am 12:05 AM

    The core features of HTML5 include semantic tags, multimedia support, form enhancement, offline storage and local storage. 1. Semantic tags such as, improve code readability and SEO effect. 2. Multimedia support simplifies the process of embedding media content through and tags. 3. Form Enhancement introduces new input types and verification properties, simplifying form development. 4. Offline storage and local storage improve web page performance and user experience through ApplicationCache and localStorage.

    See all articles

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Article

    Hot Tools

    SublimeText3 Linux new version

    SublimeText3 Linux new version

    SublimeText3 Linux latest version

    Safe Exam Browser

    Safe Exam Browser

    Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

    VSCode Windows 64-bit Download

    VSCode Windows 64-bit Download

    A free and powerful IDE editor launched by Microsoft

    PhpStorm Mac version

    PhpStorm Mac version

    The latest (2018.2.1) professional PHP integrated development tool

    MantisBT

    MantisBT

    Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.