How to

This page lists how-to guides for HTML, covering tasks such as adding JavaScript to pages, optimizing load performance, defining terms semantically, working with data-* attributes, and more.

Add a hitmap on top of an image

You can create a clickable image map in HTML using area and map elements. This article describes how to set up an image map, and some downsides to consider before you build one.

Add JavaScript to your web page

Take your webpages to the next level by harnessing JavaScript. Learn in this article how to trigger JavaScript right from your HTML documents.

Author fast-loading HTML pages

An optimized web page not only provides for a more responsive site for your visitors but also reduces the load on your web servers and internet connection. This can be crucial for high volume sites or sites which have a spike in traffic due to unusual circumstances such as breaking news stories. This article describes how to improve page load times based on common knowledge and experimentation.

Define terms with HTML

HTML provides several ways to convey description semantics, whether inline or as structured glossaries. In this article, we'll cover how to properly mark up keywords when you're defining them.

Use cross-origin images in a canvas

HTML provides a crossorigin attribute for images that, in combination with an appropriate CORS header, allows images defined by the img element that are loaded from foreign origins to be used in a canvas as if they had been loaded from the current origin.

Use data attributes

HTML is designed with extensibility in mind for data that should be associated with a particular element but need not have any defined meaning. data-* attributes allow us to store extra information on standard, semantic HTML elements without other hacks such as non-standard attributes, or extra properties on DOM.