Chapter 2. HTML Attributes

HTML is built using elements. Each of these elements will have attributes. The attributes can change how the browser renders the element, configures it, and the behavior involving the element.

The focus of the chapter will be entirely on attributes. If you are unsure about which attributes apply to which elements, the previous chapter goes over almost all the elements and the attributes that apply to them.

Global attributes

These are attributes that are available for every HTML element. However, you should note that just because the attribute is available, it does not mean that it will actually do anything.

accesskey

The accesskey attribute creates a keyboard shortcut to activate or focus on the element:

<element accesskey></element> ...

Get Web Developer's Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.