HTML5 In or Out
html5手机常见问题与工具分享

html5⼿机常见问题与⼯具分享mobileTechA useful tools or tips list for mobile web application developing这个项⽬收集移动端开发所需要的⼀些资源与⼩技巧⼯具类⽹站iphone6的那些事响应式测试⼯具Firefox 浏览器内置了⾃定义设计视图的功能,可以通过Firefox->Web 开发者->⾃定义设计视图(或者摁下Shift + Ctrl + m)。
相⽐⽹络⼯具,运⾏更加流畅,⽆需联⽹。
媒体查询常⽤样式表:<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css"> // 竖放加载<link rel="stylesheet" media="all and (orientation:landscape)"href="landscape.css"> // 横放加载//竖屏时使⽤的样式<style media="all and (orientation:portrait)" type="text/css">#landscape { display: none; }</style>//横屏时使⽤的样式<style media="all and (orientation:landscape)" type="text/css">#portrait { display: none; }</style>Web app 开发的最佳实践与中⽂总结来⾃的⼀些移动端经验总结⼲货本资料很多引⽤了指尖上的js系列基础知识meta标签meta标签,这些meta标签在开发webapp时起到⾮常重要的作⽤<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0" name="viewport" /><meta content="yes" name="apple-mobile-web-app-capable" /><meta content="black" name="apple-mobile-web-app-status-bar-style" /><meta content="telephone=no" name="format-detection" />第⼀个meta标签表⽰:强制让⽂档的宽度与设备的宽度保持1:1,并且⽂档最⼤的宽度⽐例是1.0,且不允许⽤户点击屏幕放⼤浏览;尤其要注意的是content⾥多个属性的设置⼀定要⽤分号+空格来隔开,如果不规范将不会起作⽤。
六种常见的HTML5写法误用

六种常见的HTML5写法误用在html5的写法中笔者总结6中最常见的写法错误,如下显示一、不要使用section作为div的替代品人们在标签使用中最常见到的错误之一就是随意将HTML5的<section>等价于<div>——具体地说,就是直接用作替代品(用于样式)。
在XHTML或者HTML4中,我们常看到这样的代码:<!-- HTML 4-style code --><div id="wrapper"><div id="header"><h1>My super duper page</h1><!-- Header content --></div><div id="main"><!-- Page content --></div><div id="secondary"><!-- Secondary content --></div><div id="footer"><!-- Footer content --></div></div>而现在在HTML5中,会是这样:<!-- 请不要复制这些代码!这是错误的!--><section id="wrapper"><header><h1>My super duper page</h1><!-- Header content --></header><section id="main"><!-- Page content --></section><section id="secondary"><!-- Secondary content --></section><footer><!-- Footer content --></footer></section> 这样使用并不正确:<section>并不是样式容器。
22个HTML5的初级技巧

22个HTML5的初级技巧作者:雨夜带刀类型:原创来源:雨夜带刀's Blog目录22个HTML5的初级技巧 (1)作者:雨夜带刀类型:原创来源:雨夜带刀's Blog (1)1. 新的Doctype声明 (1)2. <figure>标签 (2)3. 重新定义<small> (2)4. 去掉了Javascript和CSS标签的type属性 (2)5. 是否使用双引号 (3)6. 使网页内容可以编辑 (3)7. 电子邮件输入框 (3)8. 占位符 (4)9. 本地存储 (4)10. 更有语义的header和footer (5)11. IE对HTML5的支持 (5)12. 标题群( hgroup) (6)13. 必填项属性 (6)14. 自动获取焦点 (7)16. 视频播放的支持 (7)17. 预加载视频 (8)18. 显示控件 (8)19. 使用正则表达式 (8)20. 检测浏览器对HTML5属性的支持 (8)21. Mark标签 (9)22. 该如何正确的使用div标签 (9)Web技术的发展速度太快了,如果你不与时俱进,就会被淘汰。
因此,为了应对即将到来的HTML5,本文总结了22个HTML5的初级技巧,希望能对你进一步学习好HTML5会有所帮助。
1. 新的Doctype声明XHTML的声明太长了,我相信很少会有前端开发人员能手写出这个Doctype声明。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""/TR/xhtml1/DTD/xhtml1-transitional.dtd">HTML5的Doctype声明很短,看到这个声明相信你马上就能记住,不用浪费脑细胞去记那长的有点变态的XHTML的Doctype声明了。
<!DOCTYPE html>HTML5的简短的DOCTYPE声明是让Firefox、Chrome等现代浏览器和IE6/7/8等浏览器都进入(准)标准模式,你可能会奇怪IE6/7居然也可以支持HTML5 Doctype,事实上,IE是只要doctype符合这种格式,都会进入标准模式。
HTML5标准白皮书

HTML5A vocabulary and associated APIs for HTML and XHTMLW3C Candidate Recommendation17December2012–2Common infrastructure→1Introduction1 1.1Background1 1.2Audience1 1.3Scope1 1.4History1.5Design notes1 1.5.1Serializability of script execution1 1.5.2Compliance with other specifications1 1.6HTML vs XHTML1.7Structure of this specification1 1.7.1How to read this specification1 1.7.2Typographic conventions1 1.8Privacy concerns1.9A quick introduction to HTML1 1.9.1Writing secure applications with HTML1 1.9.2Common pitfalls to avoid when using the scripting APIs 1.10Conformance requirements for authors1 1.10.1Presentational markup1 1.10.2Syntax errors1 1.10.3Restrictions on content models and on attribute values1 1.11Recommended reading1Introduction1.1BackgroundThis section is non-normative.The World Wide Web's markup language has always been HTML.HTML was primarily designed as a language for semantically describing scientific documents,although its general design and adaptations over the years have enabled it to be used to describe a number of other types of documents.The main area that has not been adequately addressed by HTML is a vague subject referred to as Web Applications.This specification attempts to rectify this,while at the same time updating the HTML specifications to address issues raised in the past few years.1.2AudienceThis section is non-normative.This specification is intended for authors of documents and scripts that use the features defined in this specification,implementors of tools that operate on pages that use the features defined in this specification,and individuals wishing to establish the correctness of documents or implementations with respect to the requirements of this specification.This document is probably not suited to readers who do not already have at least a passing familiarity with Web technologies,as in places it sacrifices clarity for precision,and brevity for completeness.More approachable tutorials and authoring guides can provide a gentler introduction to the topic.In particular,familiarity with the basics of DOM Core and DOM Events is necessary for a complete understanding of some of the more technical parts of this specification.An understanding of Web IDL,HTTP,XML,Unicode,character encodings, JavaScript,and CSS will also be helpful in places but is not essential.1.3ScopeThis section is non-normative.This specification is limited to providing a semantic-level markup language and associated semantic-level scripting APIs for authoring accessible pages on the Web ranging from static documents to dynamic applications.The scope of this specification does not include providing mechanisms for media-specific customization of presentation(although default rendering rules for Web browsers are included at the end of this specification,and several mechanisms for hooking into CSS are provided as part of the language).The scope of this specification is not to describe an entire operating system.In particular,hardware configuration software,image manipulation tools,and applications that users would be expected to use with high-end workstations on a daily basis are out of scope.In terms of applications,this specification is targeted specifically at applications that would be expected to be used by users on an occasional basis,or regularly but from disparate locations,with low CPU requirements.Examples of such applications include online purchasing systems, searching systems,games(especially multiplayer online games),public telephone books or address books,communications software(e-mail clients,instant messaging clients,discussion software),document editing software,etc.1.4HistoryThis section is non-normative.For its first five years(1990-1995),HTML went through a number of revisions and experienced a number of extensions,primarily hosted first at CERN,and then at the IETF.With the creation of the W3C,HTML's development changed venue again.A first abortive attempt at extending HTML in1995known as HTML3.0then made way to a more pragmatic approach known as HTML3.2,which was completed in1997.HTML4quickly followed later that same year.The following year,the W3C membership decided to stop evolving HTML and instead begin work on an XML-based equivalent,called XHTML.This effort started with a reformulation of HTML4in XML,known as XHTML1.0,which added no new features except the new serialization,and which was completed in2000.After XHTML1.0,the W3C's focus turned to making it easier for other working groups to extend XHTML,under the banner of XHTML Modularization.In parallel with this,the W3C also worked on a new language that was not compatible with the earlier HTML and XHTML languages, calling it XHTML2.Around the time that HTML's evolution was stopped in1998,parts of the API for HTML developed by browser vendors were specified and published under the name DOM Level 1(in1998)and DOM Level2Core and DOM Level2HTML(starting in2000and culminating in2003).These efforts then petered out,with some DOM Level3specifications published in2004but the working group being closed before all the Level3drafts were completed.In2003,the publication of XForms,a technology which was positioned as the nextgeneration of Web forms,sparked a renewed interest in evolving HTML itself,rather than finding replacements for it.This interest was borne from the realization that XML's deployment as a Web technology was limited to entirely new technologies(like RSS and later Atom),rather than as a replacement for existing deployed technologies (like HTML).A proof of concept to show that it was possible to extend HTML4's forms to provide many of the features that XForms 1.0introduced,without requiring browsers to implement rendering engines that were incompatible with existing HTML Web pages, was the first result of this renewed interest.At this early stage,while the draft was already publicly available,and input was already being solicited from all sources,the specification was only under Opera Software's copyright.The idea that HTML's evolution should be reopened was tested at a W3C workshop in 2004,where some of the principles that underlie the HTML5work(described below), as well as the aforementioned early draft proposal covering just forms-related features,were presented to the W3C jointly by Mozilla and Opera.The proposal was rejected on the grounds that the proposal conflicted with the previously chosen direction for the Web's evolution;the W3C staff and membership voted to continue developing XML-based replacements instead.Shortly thereafter,Apple,Mozilla,and Opera jointly announced their intent to continue working on the effort under the umbrella of a new venue called the WHATWG.A public mailing list was created,and the draft was moved to the WHATWG site.The copyright was subsequently amended to be jointly owned by all three vendors,and to allow reuse of the specification.The WHATWG was based on several core principles,in particular that technologies need to be backwards compatible,that specifications and implementations need to match even if this means changing the specification rather than the implementations, and that specifications need to be detailed enough that implementations can achieve complete interoperability without reverse-engineering each other.The latter requirement in particular required that the scope of the HTML5 specification include what had previously been specified in three separate documents: HTML4,XHTML1,and DOM2HTML.It also meant including significantly more detail than had previously been considered the norm.In2006,the W3C indicated an interest to participate in the development of HTML5 after all,and in2007formed a working group chartered to work with the WHATWG on the development of the HTML5specification.Apple,Mozilla,and Opera allowed the W3C to publish the specification under the W3C copyright,while keeping a version with the less restrictive license on the WHATWG site.Since then,both groups have been working together.The HTML specification published by the WHATWG is not identical to this specification.At the time of this publication,the main differences were that the WHATWG version included features not included in this W3C version:some features have been omitted, but may be considered for future revisions of HTML beyond HTML5;and other features were omitted because at the W3C they are published as separate specifications.At time of publication of this document,patches from the WHATWG spec have been merged until revision7481inclusive.A separate document has been published by the W3C HTML working group to document the differences between the HTML specified in this document and the language described in the HTML4specification.[HTMLDIFF]1.5Design notesThis section is non-normative.It must be admitted that many aspects of HTML appear at first glance to be nonsensical and inconsistent.HTML,its supporting DOM APIs,as well as many of its supporting technologies,have been developed over a period of several decades by a wide array of people with different priorities who,in many cases,did not know of each other's existence.Features have thus arisen from many sources,and have not always been designed in especially consistent ways.Furthermore,because of the unique characteristics of the Web,implementation bugs have often become de-facto,and now de-jure,standards, as content is often unintentionally written in ways that rely on them before they can be fixed.Despite all this,efforts have been made to adhere to certain design goals.These are described in the next few subsections.1.5.1Serializability of script executionThis section is non-normative.To avoid exposing Web authors to the complexities of multithreading,the HTML and DOM APIs are designed such that no script can ever detect the simultaneous execution of other scripts.Even with workers,the intent is that the behavior of implementations can be thought of as completely serializing the execution of all scripts in all browsing contexts.The method,in this model,is equivalent to allowing other scripts to run while the calling script is blocked.1.5.2Compliance with other specificationsThis section is non-normative.This specification interacts with and relies on a wide variety of other specifications.In certain circumstances,unfortunately,conflicting needs have led to this specification violating the requirements of these other specifications. Whenever this has occurred,the transgressions have each been noted as a"willful violation",and the reason for the violation has been noted.1.6HTML vs XHTMLThis section is non-normative.This specification defines an abstract language for describing documents and applications,and some APIs for interacting with in-memory representations of resources that use this language.The in-memory representation is known as"DOM HTML",or"the DOM"for short.There are various concrete syntaxes that can be used to transmit resources that use this abstract language,two of which are defined in this specification.The first such concrete syntax is the HTML syntax.This is the format suggested for most authors.It is compatible with most legacy Web browsers.If a document is transmitted with the text/html MIME type,then it will be processed as an HTML document by Web browsers.This specification defines version5of the HTML syntax, known as"HTML5".The second concrete syntax is the XHTML syntax,which is an application of XML.When a document is transmitted with an XML MIME type,such as application/xhtml+xml,then it is treated as an XML document by Web browsers,to be parsed by an XML processor. Authors are reminded that the processing for XML and HTML differs;in particular, even minor syntax errors will prevent a document labeled as XML from being rendered fully,whereas they would be ignored in the HTML syntax.This specification defines version5of the XHTML syntax,known as"XHTML5".The DOM,the HTML syntax,and the XHTML syntax cannot all represent the same content. For example,namespaces cannot be represented using the HTML syntax,but they are supported in the DOM and in the XHTML syntax.Similarly,documents that use the noscript feature can be represented using the HTML syntax,but cannot be represented with the DOM or in the XHTML ments that contain the string"-->"can only be represented in the DOM,not in the HTML and XHTML syntaxes.1.7Structure of this specificationThis section is non-normative.This specification is divided into the following major sections:Common infrastructureThe conformance classes,algorithms,definitions,and the common underpinnings of the rest of the specification.Semantics,structure,and APIs of HTML documentsDocuments are built from elements.These elements form a tree using the DOM.This section defines the features of this DOM,as well as introducing the features common to all elements,and the concepts used in defining elements.The elements of HTMLEach element has a predefined meaning,which is explained in this section.Rules for authors on how to use the element,along with user agent requirements for how to handle each element,are also given.Loading Web pagesHTML documents do not exist in a vacuum—this section defines many of the features that affect environments that deal with multiple pages.Web application APIsThis section introduces basic features for scripting of applications in HTML.HTML documents can provide a number of mechanisms for users to interact with and modify content,which are described in this section.The HTML syntaxThe XHTML syntaxAll of these features would be for naught if they couldn't be represented ina serialized form and sent to other people,and so these sections define thesyntaxes of HTML and XHTML,along with rules for how to parse content using those syntaxes.There are also some appendices,defining rendering rules for Web browsers and listing obsolete features and IANA considerations.1.7.1How to read this specificationThis specification should be read like all other specifications.First,it should be read cover-to-cover,multiple times.Then,it should be read backwards at least once.Then it should be read by picking random sections from the contents list and following all the cross-references.As described in the conformance requirements section below,this specification describes conformance criteria for a variety of conformance classes.In particular, there are conformance requirements that apply to producers,for example authors and the documents they create,and there are conformance requirements that apply toconsumers,for example Web browsers.They can be distinguished by what they are requiring:a requirement on a producer states what is allowed,while a requirement on a consumer states how software is to act.Requirements on producers have no bearing whatsoever on consumers.1.7.2Typographic conventionsThis is a definition,requirement,or explanation.This is a note.This is an example.This is an open issue.This is a warning.interface Example{//this is an IDL definition};variable=object.methodmethod(([optionalArgument])This is a note to authors describing the usage of an interface./*this is a CSS fragment*/The defining instance of a term is marked up like es of that term are marked up like this or like this.The defining instance of an element,attribute,or API is marked up like this. References to that element,attribute,or API are marked up like this.Other code fragments are marked up like this.Variables are marked up like this.This is an implementation requirement.1.8Privacy concernsThis section is non-normative.Some features of HTML trade user convenience for a measure of user privacy.In general,due to the Internet's architecture,a user can be distinguished from another by the user's IP address.IP addresses do not perfectly match to a user; as a user moves from device to device,or from network to network,their IP address will change;similarly,NAT routing,proxy servers,and shared computers enable packets that appear to all come from a single IP address to actually map to multiple users.Technologies such as onion routing can be used to further anonymize requests so that requests from a single user at one node on the Internet appear to come from many disparate parts of the network.However,the IP address used for a user's requests is not the only mechanism by which a user's requests could be related to each other.Cookies,for example,are designed specifically to enable this,and are the basis of most of the Web's session features that enable you to log into a site with which you have an account.There are other mechanisms that are more subtle.Certain characteristics of a user's system can be used to distinguish groups of users from each other;by collecting enough such information,an individual user's browser's"digital fingerprint"can be computed,which can be as good,if not better,as an IP address in ascertaining which requests are from the same user.Grouping requests in this manner,especially across multiple sites,can be used for both benign(and even arguably positive)purposes,as well as for malevolent purposes. An example of a reasonably benign purpose would be determining whether a particular person seems to prefer sites with dog illustrations as opposed to sites with cat illstrations(based on how often they visit the sites in question)and then automatically using the preferred illustrations on subsequent visits to participating sites.Malevolent purposes,however,could include governments combining information such as the person's home address(determined from the addresses they use when getting driving directions on one site)with their apparent political affiliations(determined by examining the forum sites that they participate in)to determine whether the person should be prevented from voting in an election.Since the malevolent purposes can be remarkably evil,user agent implementors are encouraged to consider how to provide their users with tools to minimize leakinginformation that could be used to fingerprint a user.Unfortunately,as the first paragraph in this section implies,sometimes there is great benefit to be derived from exposing the very information that can also be used for fingerprinting purposes,so it's not as easy as simply blocking all possible leaks.For instance,the ability to log into a site to post under a specific identity requires that the user's requests be identifiable as all being from the same user, more or less by definition.More subtly,though,information such as how wide text is,which is necessary for many effects that involve drawing text onto a canvas(e.g. any effect that involves drawing a border around the text)also leaks information that can be used to group a user's requests.(In this case,by potentially exposing, via a brute force search,which fonts a user has installed,information which can vary considerably from user to user.)Features in this specification which can be used to fingerprint the user are marked as this paragraph is.Other features in the platform can be used for the same purpose,though,including, though not limited to:•The exact list of which features a user agents supports.•The maximum allowed stack depth for recursion in script.•Features that describe the user's environment,like Media Queries and the Screen object.[MQ][CSSOMVIEW]•The user's time zone.1.9A quick introduction to HTMLThis section is non-normative.A basic HTML document looks like this:<!DOCTYPE html><html><head><title>Sample page</title></head><body><h1>Sample page</h1><p>This is a<a href="demo.html">simple</a>sample.</p><!--this is a comment--></body></html>HTML documents consist of a tree of elements and text.Each element is denoted in the source by a start tag,such as"<body>",and an end tag,such as"</body>". (Certain start tags and end tags can in certain cases be omitted and are implied by other tags.)Tags have to be nested such that elements are all completely within each other, without overlapping:<p>This is<em>very<strong>wrong</em>!</strong></p><p>This<em>is<strong>correct</strong>.</em></p>This specification defines a set of elements that can be used in HTML,along with rules about the ways in which the elements can be nested.Elements can have attributes,which control how the elements work.In the example below,there is a hyperlink,formed using the a element and its href attribute:<a href="demo.html">simple</a>Attributes are placed inside the start tag,and consist of a name and a value, separated by an"="character.The attribute value can remain unquoted if it doesn't contain space characters or any of"'`=<or>.Otherwise,it has to be quoted using either single or double quotes.The value,along with the"="character,can be omitted altogether if the value is the empty string.<!--empty attributes--><input name=address disabled><input name=address disabled=""><!--attributes with a value--><input name=address maxlength=200><input name=address maxlength='200'><input name=address maxlength="200">HTML user agents(e.g.Web browsers)then parse this markup,turning it into a DOM (Document Object Model)tree.A DOM tree is an in-memory representation of a document.DOM trees contain several kinds of nodes,in particular a DocumentType node,Element nodes,Text nodes,Comment nodes,and in some cases ProcessingInstruction nodes.The markup snippet at the top of this section would be turned into the following DOM tree:•DOCTYPE:htmlhtmlhead#text:␣␣title#text:Sample page#text:␣o:␣#text:␣␣h1#text:Sample page#text:␣␣#text:This is aa href="demo.html"#text:simple#text:sample.#text:␣␣:this is a comment#text:␣The root element of this tree is the html element,which is the element always found at the root of HTML documents.It contains two elements,head and body,as well as a Text node between them.There are many more Text nodes in the DOM tree than one would initially expect, because the source contains a number of spaces(represented here by"␣")and line breaks("")that all end up as Text nodes in the DOM.However,for historical reasons not all of the spaces and line breaks in the original markup appear in the DOM.In particular,all the whitespace before head start tag ends up being dropped silently,and all the whitespace after the body end tag ends up placed at the end of the body.The head element contains a title element,which itself contains a Text node withthe text"Sample page".Similarly,the body element contains an h1element,a p element,and a comment.This DOM tree can be manipulated from scripts in the page.Scripts(typically in JavaScript)are small programs that can be embedded using the script element or using event handler content attributes.For example,here is a form with a script that sets the value of the form's output element to say"Hello World":<form name="main">Result:<output name="result"></output><script>document.forms.main.elements.result.value='Hello World';</script></form>Each element in the DOM tree is represented by an object,and these objects have APIs so that they can be manipulated.For instance,a link(e.g.the a element in the tree above)can have its"href"attribute changed in several ways:var a=document.links[0];//obtain the first link in the documenta.href='sample.html';//change the destination URL of the linka.protocol='https';//change just the scheme part of the URLa.setAttribute('href','/');//change the content attributedirectlySince DOM trees are used as the way to represent HTML documents when they are processed and presented by implementations(especially interactive implementations like Web browsers),this specification is mostly phrased in terms of DOM trees, instead of the markup described above.HTML documents represent a media-independent description of interactive content. HTML documents might be rendered to a screen,or through a speech synthesizer,or on a braille display.To influence exactly how such rendering takes place,authors can use a styling language such as CSS.In the following example,the page has been made yellow-on-blue using CSS.<!DOCTYPE html><html><head><title>Sample styled page</title><style>body{background:navy;color:yellow;}</style></head><body><h1>Sample styled page</h1><p>This page is just a demo.</p></body></html>For more details on how to use HTML,authors are encouraged to consult tutorials and guides.Some of the examples included in this specification might also be of use,but the novice author is cautioned that this specification,by necessity, defines the language with a level of detail that might be difficult to understand at first.1.9.1Writing secure applications with HTMLThis section is non-normative.When HTML is used to create interactive sites,care needs to be taken to avoid introducing vulnerabilities through which attackers can compromise the integrity of the site itself or of the site's users.A comprehensive study of this matter is beyond the scope of this document,and authors are strongly encouraged to study the matter in more detail.However,this section attempts to provide a quick introduction to some common pitfalls in HTML application development.The security model of the Web is based on the concept of"origins",and correspondingly many of the potential attacks on the Web involve cross-origin actions.[ORIGIN]Not validating user inputCross-site scripting(XSS)SQL injectionWhen accepting untrusted input,er-generated content such as text comments, values in URL parameters,messages from third-party sites,etc,it is imperative that the data be validated before use,and properly escaped when displayed.Failing to do this can allow a hostile user to perform a variety of attacks,ranging from the potentially benign,such as providing bogus user information like a negative age,to the serious,such as running scripts every time a user looks at a page that includes the information,potentially propagating the attack in the process,to the catastrophic,such as deleting all data in the server.When writing filters to validate user input,it is imperative that filters always be whitelist-based,allowing known-safe constructs and disallowing all other input. Blacklist-based filters that disallow known-bad inputs and allow everything else are not secure,as not everything that is bad is yet known(for example,because it might be invented in the future).For example,suppose a page looked at its URL's query string to determine what to display,and the site then redirected the user to that page to display a message, as in:<ul><li><a href="message.cgi?say=Hello">Say Hello</a><li><a href="message.cgi?say=Welcome">Say Welcome</a><li><a href="message.cgi?say=Kittens">Say Kittens</a></ul>If the message was just displayed to the user without escaping,a hostile attacker could then craft a URL that contained a script element:/message.cgi?say=%3Cscript%3Ealert%28%27Oh%20no%21%27%29% 3C/script%3EIf the attacker then convinced a victim user to visit this page,a script of the attacker's choosing would run on the page.Such a script could do any number of hostile actions,limited only by what the site offers:if the site is an e-commerce shop,for instance,such a script could cause the user to unknowingly make。
HTML5标签_和属性手册

HTML5 标签和属性手册第一部分按字母顺序分第二部分按功能分一、主体结构二、HTML 5元素标记汇总表备注:1、●表示该标记属于围堵标记,需要结束标记</标记>。
2、o 表示该标记属空标记,不需要结束标记。
五、html5中被废除的属性在HTML 4中使用的属性使用该属性的元素在HTML 5中的替代方案rev link、a relcharset link、a 在被链接的资源的中使用HTTP Comem-type头元素shape、coords a 使用area元素代替a元素longdesc img, iframe 使用a元素链接到较长描述target link 多余属性,被省略nohref area 多余属性,被省略profile head 多余属性,被省略version html 多余属性,被畨略name img idscheme meta 只为某个表单域使用schemearchive、classid、codebase, codetype、declare, standby object使用data与type属性类调用插件。
需要使用这些厲性来设S参数时,使用param属性valuetype% type param 使用name与value域性,不声明值的MIME类型axis、abbr td、th 使用以明确简洁的文字开头、后跟详述文字的形式。
可以对更洋细内容使用title属性,来使单元格的内容变得简短scope td 在被链接的资源的中使用HTTP Content-type头元素aligncaption、input legend、div、hi、h2、h3、h4、h5、h6、p使用CSS样式表替代alink、link、text, vlink、background、bgcolorbody 使用CSS样式表替代align、bgcolor、border、cellpadding、cellspacing, frame、rules、widthtable 使用CSS样式表替代align、char、charoff、height、nowrap, valigntbody、thead, tfoot 使用CSS样式表替代align、bgcolor、char、charoff,td、th 使用CSS样式表替代height, nowrap、valign, widthalign、bgcolor、char、charoff、tr 使用CSS样式表替代valignalign、char、charoff、valign、col、colgroup 使用CSS样式表替代widthalign、border, hspace、vspace object 使用CSS样式表替代clear br 使用CSS样式表替代compact, type ol、ul、li 使用CSS样式表替代compact dl 使用CSS样式表替代compact menu 使用CSS样式表替代width pre 使用CSS样式表替代align、hspace, vspace img 使用CSS样式表替代align、noshade、size、width hr 使用CSS样式表替代align、frameborder, scrolling、iframe 使用CSS样式表替代marginheight、marginwidthautosubmit menu种类说明支持浏览器search 与text文本框类似,伹是它用于搜索,比如站点搜索或Google捜索在Safari4浏览器中其外观与text不同,在其他浏览器中外观均与text相同tel 与text文本框类似,但是专用于电话在各浏览器中外观与text相同url 与tex文本框t类似,但是要求用户必须在其中正确输入url格式的文字Opera 10email 与text文本框类似,但是要求用户必须在其中正确输入email格式的文字Opera 10datetime、date、month、week、time、datetime-local各种日期与时间输入文本框Opera 10number 数值输入文本框。
HTML5的结构和语1

HTML5的结构和语义——语义性的块级元素(三)2012-01-10 15:53:06[字体:] aside figure dialog我在文章和书中一直使用前两个元素。
第三个元素我不经常用,它主要用于书面文本。
asideaside 元素代表说明、提示、边栏、引用、附加注释等,也就是叙述主线之外的内容。
例如,在developerWorks 文章中,经常会看到用表格形式编写的边栏,见代码3 用HTML 4 编写的developerWorks 边栏。
以下是代码片段:[ ]<table align="right" border="0" cellpadding="0" cellspacing="0"width="40%"><tbody><tr><td width="10"><img alt="" src="//" height="1" width="10"></td><td><table border="1" cellpadding="5" cellspacing="0" width="100%"><tbody><tr><td bgcolor="#eeeeee"><p><a name="xf-value"><span class="smalltitle">.xf-value</span></a></p> <p>The <code type="inline">.xf-value</code> selector used here styles the input field value but not its label. This is actually inconsistentwith the current CSS3 draft. The example really should use the<code type="inline">::value</code> pseudo-class instead like so:</p><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="code-outline"><pre class="displaycode">input::value { width: 20em; }#ccnumber::value { width: 18em }#zip::value { width: 12em }#state::value { width: 3em }</pre></td></tr></tbody></table><br><p>However, Firefox doesn't yet support this syntax.</p></td></tr></table>在HTML 5 中,可以按照更有意义的方式编写这个边栏,见代码4 用HTML 5 编写的developerWorks 边栏。
html5和css3入门知识

HTML5移除的元素 移除的元素
▪ font, center, strike, big, s, u, acronym, applet, dir... 移除的属性
▪ 如link和a元素的rev属性, link元素的target属性, td的scope属性,script元素的language属性, body元素的alink, link,text和vlink属性...
3
HTML5是什么 下一代 Web 语言,它不单单是一种标记语言,更为下一代 Web 提供了全新功能,并将引领下一代 Web 实
现类似桌面的应用体验。
4
HTML5是什么 HTML5将使网络标准达到符合当代的网络需求,为桌面和移动平台带来无缝衔接的丰富内容。
HTML5是为了在移动设备上支持多媒体。新的语法特征被引进以支持这一点,如video、audio和canvas 标 记。
5
HTML5是什么
新增的功能: ▪ 本地音频视频播放 ▪ 动画 ▪ 地理信息 ▪ 硬件加速 ▪ 本地运行(即使在 Internet 连接中断之后) ▪ 本地存储 ▪ 从桌面拖放文件到浏览器上传 ▪ 语义化标记
6
7
8
HTML发展历史
HTML4.0
XHTML1
XHTML2
WHATG
HTML5
1998
2000
2002
2004
2007
Web Hypertext Application Technology Working Group 很多浏览器支持html5:Safari 3.1+,FireFox 3.1+,Internet Explorer 8.0+,Google等
9
HTML5新特性基本操作解密

HTML5 新功能解密HTML5 基本新功能教程解密1) 什么是 HTML5?HTML5 将成为 HTML、XHTML 以及 HTML DOM 的新标准。
2) HTML5 是如何起步的?HTML5 是 W3C 与 WHATWG 合作的结果。
为 HTML5 建立的一些规则: 新特性应该基于 HTML、CSS、DOM 以及 JavaScript。
减少对外部插件的需求(比如 Flash) 更优秀的错误处理 更多取代脚本的标记 HTML5 应该独立于设备3) 新特性HTML5 中的一些有趣的新特性: 用于绘画的 canvas 元素 用于媒介回放的 video 和 audio 元素 对本地离线存储的更好的支持 新的特殊内容元素,比如 article、footer、header、nav、section 新的表单控件,比如 calendar、date、time、email、url、searchHTML 5 视频4) Web 上的视频HTML5 规定了一种通过 video 元素来包含视频的标准方法。
视频格式当前,video 元素支持三种视频格式: 格式 Ogg MPEG 4 WebM IE No 9.0+ No Firefox 3.5+ No 4.0+ Opera 10.5+ No 10.6+ Chrome 5.0+ 5.0+ 6.0+ Safari No 3.0+ No 1HTML5 新功能解密 Ogg = 带有 Theora 视频编码和 Vorbis 音频编码的 Ogg 文件 MPEG4 = 带有 H.264 视频编码和 AAC 音频编码的 MPEG 4 文件 WebM = 带有 VP8 视频编码和 Vorbis 音频编码的 WebM 文件5) 如何工作<video src="movie.ogg" controls="controls"> </video> control 属性供添加播放、暂停和音量控件。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
支持位置服务
HTML5面临的挑战
• • 1 暂时只能兼容高端设备 2 跨平台测试成本高 3 多种设备,多种屏幕尺寸 4 标准的出台还遥遥无期 5 与原生应用的PK 6 离线脱机怎么办?
•Байду номын сангаас
• • •
讨论
靠谱么?
从哪里入手?
课程体系中 如何操作?
入手
游戏先行?
我们可以做什么?
<command> 标记定义一个命令按钮 <datalist> 标记定义一个下拉列表 <details> 标记定义一个元素的详细内容 <dialog> 标记定义一个对话框(会话框) <embed> 标记定义外部的可交互的内容或插件 <figure> 标记定义一组媒体内容以及它们的标题<footer> 标记定义一个页面或一个区域的 底部 <header> 标记定义一个页面或一个区域的头部 <hgroup> 标记定义文件中一个区块的相关信息 <keygen> 标记定义表单里一个生成的键值 <mark> 标记定义有标记的文本 <meter> 标记定义 measurement within a predefined range <nav> 标记定义导航链接 <output> 标记定义一些输出类型 <progress> 标记定义任务的过程 <rp> 标记是用在Ruby annotations 告诉那些不支持 Ruby元素的浏览器如何去显示 <rt> 标记定义对ruby annotations的解释 <ruby> 标记定义 ruby annotations. <section> 标记定义一个区域 <source> 标记定义媒体资源 <time> 标记定义一个日期/时间 <video> 标记定义一个视频
HTML5初探
OutLine
应用演示
发展叱
驱动力 优势 劣势 我们可以...
HTML5发展历叱
HTML5的推动力
手机上网趋势
搜索更容易
简化开发 跨平台
HTML5的优势
降低插件的
重要性
提高浏览器的
安全性
支持动态生成
图像
允许Web程序利用 本地存储
Widget
让Web视频
播放更流畅
简化Web开发中