Home > Articles > Web Development > HTML/CSS

Five HTML5 Techniques to Learn Now

Cameron Laird thinks you should start using HTML5. Do you need to immerse yourself in script language and lists of tags? Nope. By learning just a few speedy techniques, you can convert your older-style HTML coding to something more modern that works smoothly and makes your pages easier to use.
Like this article? We recommend

Like this article? We recommend

No doubt about it: HTML5 is hot stuff. A year or two ago it was esoteric and unripe; now it's necessary. But does it still make you uncomfortable?

Your hesitation is understandable: Parts of HTML5 are still years away from completion, and other parts involve programming concepts that were entirely absent from front-end work up through HTML4. Don't let those realities intimidate you, though. You can and should take your first HTML5 steps today!

HTMLDOC and Validation: The Easiest Leap Forward

As this article demonstrates, your first few steps will be easy to apply immediately, they'll likely improve your HTML right away, and they won't demand that you learn any client-side scripting or programming. Before you do anything else, for instance, learn how to upgrade existing HTML to HTML5, as well as create new HTML5 source.

You probably already have source that looks like this:

<html>
<head>
<title>The Title</title>
</head>
<body>
    ...
</body>
</html>

If so, you should transform it to look more like this:

<!DOCTYPE html>
<html>
<head>
<title>The Title</title>
</head>
<body>
    ...

</body>
</html>

Simple enough, right?

As tiny as this change appears at first, it has significant benefits:

  • Essentially all pertinent browsers, even those from before the year 2000, recognize this DOCTYPE as a marker of standards-based source. This puts them on their best behavior in regard to minimization of vendor-specific interpretations.
  • You can validate your source as HTML5. Have you ever validated your HTML source? It's a great thing to do, and becomes even better with HTML5.

The advantages of HTML5 validation are actually a bit more subtle. Validation is a priceless technique—roughly, using an easy "grammar checker" for HTML—and you definitely should become familiar with it. The best return on your investment will come when you not only validate, but also check your HTML. You'll need two things:

These tools quickly detect common spelling errors, missing characters, and other mistakes that plague many HTML sources. On a recent day when I used validator.nu to scan http://apple.com/, for instance, the validator detected four distinct and definite errors, including use of an obsolete frameborder attribute for iframe. However extensive your experience with HTML, and however disciplined your process for source creation, modern validation tools will likely improve your results.

Pick a Date

Do your end users ever need to schedule a future event, such as the expiration for an offer, or a target for a test run? Before HTML5, your choices for such a selection were simple textbox fill-ins with annoyingly complex validation (calendrical rules are complicated), or a more appealing graphical widget from any of several competing libraries.

Now your choice is much simpler:

<input type = "date" ...

This is HTML5's standard way of receiving user input for a calendar date. A sufficiently modern browser enforces that the only value that can result is a valid date. In the worst case, the input falls back to behave as an old-style textbox.

There's More! Further Structure for Your Forms

date is only one of 13 new input types that HTML5 makes available. You'll eventually want to learn and incorporate all of them. The availability of these new types allows you to concentrate on domain- and customer-specific concepts, while leveraging standard widgets for numeric values, search boxes, locale-savvy telephone numbers, color selection, and more.

Think for a moment how you'd ask your end user to pick a number between 1 and 50. You could construct a list box with 50 elements, but that would look awkward on most pages, and it would be clumsy to maintain as HTML. You could have users fill in a two-position text box and validate the result, with the overhead involved in programming validation. Or, with HTML5, you can write this:

<input type = "number" min = "1" max = "50" ...

With this option, you'll be certain that users can enter only proper whole numbers in the desired range. Even better than that, the user's view is of a standard widget that invites correct data entry.

Curious about which widgets work with which browsers? Learn the latest on this score with the Modernizr library, which efficiently detects and reports HTML5 feature support.

Join the Media Club

HTML5 is a large standard. Not only does the article you're reading right now not teach it all, but you probably will never learn all of it. That's okay; in fact, the most important aim of this article is not the five specific HTML5 items covered here, but the right attitude to have about HTML5. It's safe to learn little parts of HTML5 as they become useful to you, and then you can build on those parts to expand your HTML5 expertise.

Video is a part of HTML5 that illustrates this principle very well. As you'll see in a moment, you can learn one video construct right now that will pay off immediately for you. As your experience and comfort with it grows, you'll probably extend what you've learned "horizontally," into audio playback, and "vertically," where you'll acquire knowledge about different codecs and their roles, as well as the video configurations that HTML5 supports.

The place to start is with a simple tag:

<video src = "my_movie.webm"></video>

With this tag, you can embed your video on a web page, but not force end users into dependency on specific proprietary plug-ins such as Flash or QuickTime. That's a good thing! In fact, not only do most modern desktop browsers support video, but so do browsers available for most smartphones.

It's also far from the end. As you work with media formats, you'll learn that multimedia formatting is encumbered with technical tradeoffs—and, even more, legal complexity. But it's right to begin simply by replacing the object, embed, or whatever you've been using, with video.

Search and Other Engines

While most of HTML5—especially the graphical parts frequently publicized in strategic discussions—requires JavaScript programming, at least one more important piece of HTML5 should be known to those operating purely at the tag level: HTML5 microdata. When we work with input and video and so on, we think in terms of what humans see, but web pages have another audience: search engines and other computer applications. Microdata can help you to get across the point of your web page to robotic readers.

In so-called search-engine optimization (SEO) circles, there's abundant speculation that the right microdata will move a page up in competitive search result rankings. While SEO is outside the scope of this introduction, it's likely that you'll be asked about microdata sometime. You'll need to learn enough about it to be able to answer with confidence that, yes, you can add HTML5 microdata markup.

Although HTML5 microdata operates mostly in the realm of tagged markup, it has even more depth and difficulty than video. Eventually you should read a couple of the fine tutorials that are available. For now, think of a specific concrete example: the "Contact Us" page on the last website you did. Here's how it might look with microdata decorations:

<div itemscope itemtype = "http://data-vocabulary.org/Organization">
<h3 itemprop = "name">The Organization</h3>
This is a great organization.  Here is what
we say for people to read.
  <div itemprop = "address" itemscope
       itemtype = "http://data-vocabulary.org/Address">
  <span itemprop = "street-address">135 Elm Street</span>

     ...

People will read this coding, including the physical address, and casually focus on the specific details of interest—street address, telephone number, and so on, based on experience that teaches us "135 Elm Street" is more likely to be a street address than to be the name of the CEO. But itemprop explicitly identifies for search engines that this is a street-address, with the name of an Organization, and more. With HTML5 microdata, you clearly identify the tel and fax, and eliminate any possibility that search engines will mistake one for the other.

As with the other HTML5 elements in this introduction, you can start experimenting with microdata right away. However, the payoffs aren't as immediate: It's hard to be certain what a search engine "thinks" as it reads your pages, and browsers themselves are only beginning to interpret semantic markup.

You can set your own schedule for learning these various elements, as they're almost entirely independent of each other. In a world where so many readers are holding HTML5-enabled mobile handsets, however, surely now is the right time to start.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020