Home > Web Front-end > H5 Tutorial > body text

Examples to explain some applications of HTML5 meta tags _html5 tutorial skills

WBOY
Release: 2016-05-16 15:46:07
Original
1914 people have browsed it

Main differences in meta tag usage between HTML 4.01 and HTML 5:

In HTML 5, the scheme attribute is no longer supported.

In HTML 5, there is a new charset attribute that makes character set definition easier.

In HTML 4.01, you have to write:

XML/HTML CodeCopy content to clipboard
  1. <meta http-equiv="content-type " content="text/html; charset=ISO-8859-1">

In HTML 5, this is enough:

XML/HTML CodeCopy content to clipboard
  1. <meta charset="ISO-8859-1 "> 

Example

Define keywords for search engines:

XML/HTML CodeCopy content to clipboard
  1. <meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript" />

Define the description of the page:

XML/HTML CodeCopy content to clipboard
  1. <meta name="description" content="Free web technology tutorial." />

The latest version of the definition page:

XML/HTML CodeCopy content to clipboard
  1. <meta name="revised" content="David, 2008/8/8/" />

Refresh the page every 5 seconds:

XML/HTML CodeCopy content to clipboard
  1. <meta http-equiv="refresh" content="5" />

Attributes
2015128114639927.png (639×396)

Standard Properties

class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title For a complete description, please visit Standard Properties in HTML 5.

Event Properties

onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover , onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload. For a complete description, please visit the event attributes in HTML 5.

Example

Document Description

XML/HTML CodeCopy content to clipboard
  1. <html>
  2. <head>
  3. <meta http-equiv=" Content-Type" content="text/html; charset=gb2312" />
  4. <meta name="author" content="w3school.com.cn">
  5. <meta name="revised" content="David Yang,8/1/07">
  6. <meta name="generator" content="Dreamweaver 8.0en">
  7. head>
  8. <body>
  9. <p>The meta attribute of this document identifies the author and editing software. p>
  10. body>
  11. html>
The information in the

Meta element describes the HTML document.

Document Keywords

XML/HTML CodeCopy content to clipboard
  1. <html>  
  2. <head>  
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  
  4. <meta name="description" content="HTML examples">  
  5. <meta name="keywords" content="HTML, DHTML, CSS, XML, XHTML, JavaScript, VBScript">  
  6. head>  
  7. <body>  
  8. <p>本文档的 meta 属性描述了该文档和它的关键词。p>  
  9. body>  
  10. html>  

Meta 元素中的信息可以描述文档的关键词。

重定向

XML/HTML Code复制内容到剪贴板
  1. <html>  
  2. <head>  
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  
  4. <meta http-equiv="Refresh" content="5;url=http://www.w3school.com.cn">  
  5. head>  
  6. <body>  
  7. <p>  
  8. 对不起。我们已经搬家了。您的 URL 是 <a href="http://www.w3school.com.cn"> http://www.w3school.com.cn a>  
  9. p>  
  10. <p>您将在 5 秒内被重定向到新的地址。p>  
  11. <p>如果超过 5 秒后您仍然看到本消息,请点击上面的的链接。p>  
  12. body>  
  13. html>  

这个例子演示:在网址已经变更的情况下,将用户重定向到另外一个地址。

移动前端开发中添加一些webkit专属的HTML5头部标签,帮助浏览器更好解析html代码,更好地将移动web前端页面表现出来。本文整理一些常用的meta标签。

XML/HTML Code复制内容到剪贴板
  1. >
  2. <head>
  3.  <meta charset='utf- 8'> 
  4. " X-ua-compatible "
  5. Content = " IE = Edge, Chrome = 1 "/& gt;  <meta
  6. name="description"
  7. content="No more than 150 characters"/>  <meta
  8. name="keywords"
  9. content=""/>  <meta
  10. name="author"
  11. content="name, email@gmail.com"/>  <meta
  12. name="robots"
  13. content="index,follow"/>
  14.  <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no "> 
  15.  <meta name="apple- mobile-web-app-title" content="title">
  16.  <meta name="apple- mobile-web-app-capable" content="yes"/>
  17.  <meta name="apple- itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL"> 
  18.  <meta name="apple- mobile-web-app-status-bar-style" content="black"/>
  19.  <meta name="format- detection" content="telphone=no, email=no"/>
  20.  <meta name="renderer" content="webkit">
  21. " " >
  22. " Cache-Control" content="no-siteapp" />
  23.  
  24. <meta name="HandheldFriendly" content="true">
  25.  
  26. <
  27. meta name="MobileOptimized" content="320">
  28.  
  29. <
  30. meta name="screen- orientation" content="portrait">
  31.  
  32. <
  33. meta name="x5- orientation" content="portrait">
  34.  
  35. <
  36. meta name="full- screen" content="yes">
  37.  <meta name="x5- fullscreen" content="true">
  38.  <meta name="browsermode" content="application">
  39.  <meta name="x5- page-mode" content="app">
  40.  <meta name="msapplication- tap-highlight" content="no">
  41.  <link rel="apple- touch-icon-precomposed" href="/apple-touch-icon-57x57-precomposed.png"/> 
  42.  <link rel="apple- touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114x114-precomposed.png"/>
  43.  <link rel="apple- touch-startup-image" sizes="768x1004" href="/splash-screen-768x1004.png"/>
  44.  <link rel="apple- touch-startup-image" sizes="1536x2008" href="/splash-screen-1536x2008.png"/>
  45.  <link rel="apple- touch-startup-image" sizes="1024x748" href="/Default-Portrait-1024x748.png"/>
  46.  <link rel="apple- touch-startup-image" sizes="2048x1496" href="/splash-screen-2048x1496.png"/>
  47.  <link rel="apple- touch-startup-image" href="/splash-screen-320x480.png"/> ;
  48.  <link rel="apple- touch-startup-image" sizes="640x960" href="/splash-screen-640x960.png"/> 
  49.  <link rel="apple- touch-startup-image" sizes="640x1136" href="/splash-screen-640x1136.png"/> 
  50.  
  51.  <meta name="msapplication- TileColor" content="#000"/>
  52.  <meta name="msapplication- TileImage" content="icon.png"/>
  53.  <link rel="alternate" type="application/rss xml" title="RSS" href="/rss.xml"/ >
  54.  <link rel="shortcut icon " type="image/ico" href="/favicon.ico"/>
  55.  <meta property="og: type" content="type" />
  56.  <meta property="og: url" content="URL address" />
  57.  <meta property="og: title" content="title" />
  58.  <meta property="og: image" content="image" />
  59.  <meta property="og: description" content="description" />
  60.  <title>titletitle>
  61. head>
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template