John M. Astell ♦ Portfolio
When people talk about "HTML5," they often include a number of web technologies that were developed at about the same time as HTML5. (Some, like local and session storage, were even originally part of the HTML5 project before being made separate.) This page demonstrates features of both HTML5 and the other web technologies.
meter tag allows you show a meter that can be progressively filled or emptied. It's designed to be used with a defined range (like 0 to 100) and is not supposed to be used as a progress bar (that's what the progress tag is for). A meter can be dynamically manipulated via JavaScript, so it is actually more useful than a progress bar for many tasks. For example, you could use it in a game to track the number of times you successfully hit a target over time: 3 hits out of 5 attempts, 3 out of 6, 4 out of 7, etc. Although the "defined" range changes with each attempted hit, the range is always defined at all times.The meter is 6/7th filled.
progress tag allows you show a progress bar that fills based on the progress to a specified maximum. It's not supposed to be used as a meter or gauge (that's what the meter tag is for). The filled part of the bar is animated. On its own, the progress bar does not dynamically update, as it has no way to know what it is supposed to be tracking. It can be dynamically updated via JavaScript, so as long as you can track via JavaScript the progress of what you want to measure.progress tag well—or even at all. One way to handle this is have a fallback (for example, a progress bar done in CSS), although this increases the work to be done.Use the Start button to see the bar fill as 10 seconds elapse.
Use the Start button to see the bar fill as 10 seconds elapse.
data-. This allows you to directly embed custom data for an element in a way that won't be displayed when the page is rendered but is available for use by JavaScript. The values in these attributes are accessible even in non-HTML5 browsers, through JavaScript's getAttribute() method or via jQuery, which is what this demo uses. (jQuery is quite useful for this, as you can't yet count on accessing the values of data attributes using the DOM dataset property. While most modern browsers support the property, support is not universal, and many older browsers still in widespread use don't support it at all.)Put the mouse over this box!
<div class="demoDivs" id="dataDemo" data-help="Help text for this item.">
contenteditable="true" can be added to very many elements, and it allows the user to edit the content of the element. This is useful, for example, for things users may want to change, like their contact information. By itself, contenteditable doesn't actually save what the user enters, but the data can be saved in various ways, such as by JavaScript using AJAX, JSON, or by local storage.You can change the text in this box. Go ahead and try it. (Changes won't be saved.)
contenteditable element is that the cursor is placed based on where the user clicks in the element, and none of the content is selected. This behavior can be changed using JavaScript. For the demo below, it's assumed that if the user clicks in the box to change the content, the user will want to change all the content, and so all the content is automatically selected.When you click in the box, all the content will be selected. (Changes won't be saved.)
| Input Attribute | Example | Notes |
| <input ... autofocus> | If JavaScript is enabled in your browser, this box will display whether your browser supports autofocus.
|
Various elements, including input tags, can use the autofocus attribute to cause the browser to put the focus on that element when the page loads. autofocus is extremely useful for forms, as the user doesn't have to click or otherwise interact with the page just to start using the form. However, autofocus should only be used on pages where use of the control or input is the expected first interaction with the page. Otherwise, the page may behave differently than the user is expecting. For example, if the page loads with the autofocus on an element that is off screen, the user may take actions that actually interact with the off-screen element and not see anything happen on screen. That's why this autofocus demo is designed to be run on its own.Note: autofocus does not play well when loaded into a page using AJAX. The HTML5 specification did not specify when to check for autofocus in sufficient detail to ensure consistent usage across all browsers. Accordingly, browsers have implemented it in different ways. Some browsers (some versions of Firefox and Safari, for example) only check for autofocus on the initial page load but not when new content is downloaded via AJAX. Others check for autofocus when new content is downloaded via AJAX and adjust the focus accordingly. So, either do not use autofocus in AJAX-downloadable content or supply a JavaScript fallback to autofocus to ensure you get what you want. |
| <input ... placeholder="Start typing here"> | Many input types can use the placeholder attribute to show placeholder text (like help information) for the input. The placeholder text disappears when the user starts to type in the field. |
|
| <input ... list="listExample"> | Many input types can use the list attribute to associate an autocomplete list for the input. In the text box to the left, enter one of the following: a, b, or c (either case), and you will get an autocomplete suggestion. Choosing a suggestion then fills the field with the value associated with the suggestion. |
|
| <input ... required> | Text field input types can use the required attribute to ensure that the field contains user input before it is submitted. When the user uses the Submit button, the input is checked. If it is empty, the browser displays an error prompt. For this demo, leave the text field empty and press Submit. |
|
| <input ... pattern="[1-3]{1}"> | Many input types can use the pattern attribute to provide a JavaScript regular expression pattern. When the user uses the Submit button, the input is checked against the pattern. If the input is incorrect, it is not submitted, and the browser displays an error prompt. For this demo, the input can only be a single number and can only be one of the following: 1, 2, or 3. |
|
| Input Type | Example | Notes |
| <input ... type="range"> | This input type creates a slider for users to graphically select a number in a range of numbers. Note that the control does not display the number the slider is at (you can do this with JavaScript). | |
| <input ... type="number"> | This input type allows users to select a number (in this case, from 0 to 50 in steps of 5, with a default of 15). | |
| <input ... type="color"> | This input type allows users to pick a color. | |
| <input ... type="date"> | This input type allows users to pick a date. There are also input types for selecting a month, week, time, date & time, and local date & time. |
|
| <input ... type="email"> | This input type allows users to enter an email address. A default address can be supplied. Some browsers that support the type try to check if the user's entry is a well-formed email address and take some action if it is not. | |
| <input ... type="url"> | This input type allows users to enter a URL. A default URL can be supplied. Some browsers that support the type check if the user's entry is a well-formed URL and display a prompt if it is not. Safari v5.1.7 for Windows supports the type but does not check the address. You can't effectively use pattern to provide your own check, as even though Safari v5.1.7 recognizes this attribute, it doesn't do anything with it. (JavaScript of course could be used to check the user's entry.) |
|
| <input ... type="tel"> | This input type allows users to enter a telephone number. A default number can be supplied. | |
| <input ... type="search"> | This input type allows users to enter text for a search. Currently, all browsers that support this type show the input field exactly like a text field, although this might change someday. |
video tag allows web pages to natively display videos, without the need for plugins or extensions. Good news! Unfortunately, as it seems to have always been the case with the web since Microsoft decided to destroy Netscape, there's bad news, too. The major browsers use different technologies, so you have to process and provide the video for at least two "containers:"video tag allows a Flash object to be included but used only if no HTML5 video source runs), and 2) simply allow the user to download the file and run it locally. However, I'm demoing HTML5 video here and not fallbacks.audio tag works quite similar to the video tag and allows web pages to natively play audio files, without the need for plugins or extensions. Like video, you need to include multiple formats to handle all the major browsers: .mp3 and .ogg files do the trick. Demo time!audio tag (see the HTML video demo above for more details), and 2) simply allow the user to download the file and run it locally. However, I'm demoing HTML5 audio here and not fallbacks.Test results will appear here if JavaScript is enabled.
Your saved entries:
tutorialCompleted='true' in the data store.) Test results will appear here if JavaScript is enabled.
Your saved entries:
chrome://appcache-internals/ in the address bar, press Enter or Return, and then individually clear each manifest listing. There's no Clear All ability in Chrome. Firefox, on the other hand, does list the application cache in Options->Advanced->Network (calling it "Offline Web Content") and does allow the entire application cache to be cleared in one click.)base_styles.css?v110313) each time you change the file, but that, too, can be impractical if you have a lot of links to maintain. Instead, you can put the file in the application cache by just updating one manifest file, which multiple pages can use.Use this link to see the Offline API Demo. Note: About 1.1 MB of files will be placed in the application cache when you go to this page.
If JavaScript is enabled, this box displays whether your browser supports the History API.
Origin of the document in this page:
If JavaScript is enabled in your browser, this box will display whether your browser supports geolocation.
Use Find Me to get your location.
window, document, and parent objects.If JavaScript is enabled in your browser, this box will display whether your browser supports Web Workers.
If JavaScript is enabled in your browser, this box will display whether your browser supports Web Push Notifications.
If JavaScript is enabled in your browser, this box will display whether your browser supports HTML5 Drag and Drop.