大佬教程收集整理的这篇文章主要介绍了22 个常见的HTML5技巧和实际应用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
1,新DOCTYPE
还在使用那个讨厌的的标准doctype?试试下面这个
<!DOCTYPE HTML >
small重新定义
不久前,我使用了<small>标签来创建与logo相关的副标题。但是在HTML5中重新定义了<small>标签,使之更能表现语义化,在<small>的字号都会变小,想想如果这个标签用于网站的底部的版权信息还是个不错的做法。
<link href="path/to/stylesheet.css">
<script src="path/to/script.js"></script>
是否使用双引号
<h6 id="somEID"> Start the reactor.? </h6>
使网页内容可以编辑
<h6 contenteditable="true">Break mechanical cab <span>driver</span></h6>
<form method="get">
<label for="email">Email:</label>
<input id="email" name="email" type="email">
<button> Submit Form </button>
</form>
占位符
<input name="email" placeholder="[email protected]" type="email">
本地存储
HTML5的本地存储功能,可以让现代浏览器“记住”我们输入的,就算浏览器关闭和刷新也不会受影响。虽然这个功能有些浏览器不支持,但是IE8,Safari 4,还有 Firefox 3.5还是支持这个功能的,你可以测试下。自己是一个五年的全栈工程师,这里推荐一下我的前端学习交流君羊:前面是四八四,中间七五七,最后七六零,群里会不定期更新最新的教程和学习方法,有想学习web前端的,或是转行,或是大学生,还有工作中想提升自己能力的web前端党欢迎加入,
<footer>
...
</footer>
<input type="text" name="someInput" required>
<input type="text" name="someInput" required="required">
<input name="someInput" placeholder="Douglas Quaid" required="required" autofocus="autofocus" type="text">
<audio tabindex="0" autoplay="autoplay" controls="controls">
<source src="file.ogg">
<source src="file.mp3">
<a href="file.mp3">Download this file.</a>
</audio>
为什么会有两种格式的音频文件?因为Firefox和Webkit浏览器所支持的格式存在差异,Firefox只能支持.ogg文件,而Webkit只支 持.mp3的文件,解决的办法就是创建两个版本的音频文件,这样就可以兼容Firefox和Webkit的浏览器了,需要注意的是IE不支持该标签。
<video tabindex="0" controls="" preload="">
<source src="cohagenPhoneCall.ogv" type="video/ogg; codecs=‘vorbis,theora‘">
<source src="cohagenPhoneCall.mp4" type="video/mp4; ‘codecs=‘avc1.42E01E,mp4a.40.2‘">
<div> Your browser is old. <a href="cohagenPhoneCall.mp4">Download this video ×××tead.</a> </div>
</video>
<video tabindex="0" preload="preload" controls="controls">
...
</video>
<form action="" method="post">
<label for="username">Create a Username: </label>
<input name="username" id="username" placeholder="4 <> 10" pattern="[A-Za-z]{4,10}" autofocus="autofocus" required="required" type="text">
<button type="submit">Go </button>
</form>
alert( ‘pattern‘ in document.createElement(‘input‘) ) // Boolean;
<h3> Search Results </h3>
<h6> They werE interrupted,just after Quato said,<mark>"Open your Mind"</mark>. </h6>
以上是大佬教程为你收集整理的22 个常见的HTML5技巧和实际应用全部内容,希望文章能够帮你解决22 个常见的HTML5技巧和实际应用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。