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
    What Does H5 Refer To? Exploring the ContextWhat Does H5 Refer To? Exploring the ContextApr 12, 2025 am 12:03 AM

    H5referstoHTML5,apivotaltechnologyinwebdevelopment.1)HTML5introducesnewelementsandAPIsforrich,dynamicwebapplications.2)Itsupportsmultimediawithoutplugins,enhancinguserexperienceacrossdevices.3)SemanticelementsimprovecontentstructureandSEO.4)H5'srespo

    H5: Tools, Frameworks, and Best PracticesH5: Tools, Frameworks, and Best PracticesApr 11, 2025 am 12:11 AM

    The tools and frameworks that need to be mastered in H5 development include Vue.js, React and Webpack. 1.Vue.js is suitable for building user interfaces and supports component development. 2.React optimizes page rendering through virtual DOM, suitable for complex applications. 3.Webpack is used for module packaging and optimize resource loading.

    The Legacy of HTML5: Understanding H5 in the PresentThe Legacy of HTML5: Understanding H5 in the PresentApr 10, 2025 am 09:28 AM

    HTML5hassignificantlytransformedwebdevelopmentbyintroducingsemanticelements,enhancingmultimediasupport,andimprovingperformance.1)ItmadewebsitesmoreaccessibleandSEO-friendlywithsemanticelementslike,,and.2)HTML5introducednativeandtags,eliminatingthenee

    H5 Code: Accessibility and Semantic HTMLH5 Code: Accessibility and Semantic HTMLApr 09, 2025 am 12:05 AM

    H5 improves web page accessibility and SEO effects through semantic elements and ARIA attributes. 1. Use, etc. to organize the content structure and improve SEO. 2. ARIA attributes such as aria-label enhance accessibility, and assistive technology users can use web pages smoothly.

    Is h5 same as HTML5?Is h5 same as HTML5?Apr 08, 2025 am 12:16 AM

    "h5" and "HTML5" are the same in most cases, but they may have different meanings in certain specific scenarios. 1. "HTML5" is a W3C-defined standard that contains new tags and APIs. 2. "h5" is usually the abbreviation of HTML5, but in mobile development, it may refer to a framework based on HTML5. Understanding these differences helps to use these terms accurately in your project.

    What is the function of H5?What is the function of H5?Apr 07, 2025 am 12:10 AM

    H5, or HTML5, is the fifth version of HTML. It provides developers with a stronger tool set, making it easier to create complex web applications. The core functions of H5 include: 1) elements that allow drawing graphics and animations on web pages; 2) semantic tags such as, etc. to make the web page structure clear and conducive to SEO optimization; 3) new APIs such as GeolocationAPI support location-based services; 4) Cross-browser compatibility needs to be ensured through compatibility testing and Polyfill library.

    How to do h5 linkHow to do h5 linkApr 06, 2025 pm 12:39 PM

    How to create an H5 link? Determine the link target: Get the URL of the H5 page or application. Create HTML anchors: Use the <a> tag to create an anchor and specify the link target URL. Set link properties (optional): Set target, title, and onclick properties as needed. Add to webpage: Add HTML anchor code to the webpage where you want the link to appear.

    How to solve the h5 compatibility problemHow to solve the h5 compatibility problemApr 06, 2025 pm 12:36 PM

    Solutions to H5 compatibility issues include: using responsive design that allows web pages to adjust layouts according to screen size. Use cross-browser testing tools to test compatibility before release. Use Polyfill to provide support for new APIs for older browsers. Follow web standards and use effective code and best practices. Use CSS preprocessors to simplify CSS code and improve readability. Optimize images, reduce web page size and speed up loading. Enable HTTPS to ensure the security of the website.

    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

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. How to Fix Audio if You Can't Hear Anyone
    3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    WWE 2K25: How To Unlock Everything In MyRise
    4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    DVWA

    DVWA

    Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    mPDF

    mPDF

    mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

    EditPlus Chinese cracked version

    EditPlus Chinese cracked version

    Small size, syntax highlighting, does not support code prompt function