A great deal of money will be spent over the next several years to rewrite and update existing websites to HTML5. Essentially this is a pre-Y2K period for web developers: a lucrative, once-in-a-generation opportunity to be part of an epochal change.
在接下来的几年中,将花费大量资金来重写现有网站并将其更新为HTML5。 从本质上讲,这是Web开发人员进入Y2K之前的时期:一个有利可图的,千载难逢的机会,成为时代变革的一部分。
Technically, merely changing the first line of the HTML code on a page to <!DOCTYPE html>
is enough to make it HTML5; even loosely coded pages should validate, given HTML5's lowering of standards.
从技术上讲,仅将页面上HTML代码的第一行更改为<!DOCTYPE html>
就足以使其成为HTML5。 鉴于HTML5降低了标准 ,即使是松散编码的页面也应进行验证。
Doing so, however, is a merely superficial nod to HTML5. Taking complete advantage of the spec – making a true HTML5 page – means rewriting and re-contextualizing code everywhere in the page.
但是,这样做只是对HTML5的肤浅表述。 充分利用规范–制作一个真正HTML5页面–意味着重写页面中的代码并使代码重新上下文化。
This article will outline the workflow process for converting a complete, valid, XHTML 1.0 Strict document to HTML5. It consists of several steps:
本文将概述将完整,有效的XHTML 1.0 Strict文档转换为HTML5的工作流程。 它包括几个步骤:
Make a copy of your entire website, and work your changes on the copy
制作整个网站的副本 ,然后在副本上进行更改
You do not want to be caught halfway through the process and forget what you have changed, or lose your references before rewriting your CSS.
您不想在过程中途陷入困境,而忘记了所做的更改,或者在重写CSS之前丢失了引用。
Change the
DOCTYPE
and<head>
section to HTML5 markup将
DOCTYPE
和<head>
部分更改为HTML5标记Remove Dublin Core metadata
删除都柏林核心元数据
Add microformats and microdata as appropriate.
适当添加微格式和微数据。
Traditional metadata is supplemented (and, to a degree, supplanted) by microformats and microdata in HTML5. The appropriate markup to add, and its associated data, will depend on the content of your page and how it is used.
HTML5中的微格式和微数据对传统的元数据进行了补充(并在一定程度上替代了)。 要添加的适当标记及其相关数据,将取决于页面的内容及其使用方式。
Update tags for external stylesheets and JavaScript files
更新外部样式表和JavaScript文件的标签
The links themselves will not change, but you should remove unneeded attributes such as
type
.链接本身不会改变,但是您应该删除不需要的属性,例如
type
。Replace generic
<div>
containers with their appropriate HTML5 tags将普通的
<div>
容器替换为其相应HTML5标签<div id="header">
,<div id="footer">
,<div id=sidebar>
and<ul id=nav>
or their equivalents, should be replaced with<header>, <footer>, <aside> and <nav>
respectively.<div id="header">
,<div id="footer">
,<div id=sidebar>
和<ul id=nav>
或其等效项应替换为<header>, <footer>, <aside> and <nav>
分别。Divide remaining content, if self-explanatory, with
<section>
tags如果不言自明,请用
<section>
标签划分剩余内容
This is the minimum number of steps you should take to transform an existing web page into HTML5; I'd also suggest that the update process also allows the opportunity for a thorough review of a site's design and features.
这是将现有网页转换为HTML5所需的最少步骤; 我还建议,更新过程还应使您有机会全面审查网站的设计和功能。