/

HTML / CSS / JavaScript Tutorial

HTML Global attributes

[this page | pdf | back links]

Different HTML elements can have attributes that specify how they should be formatted or interpreted or allow further characterisation of the element, which can be either standard attributes or event attributes. Some standard attributes can apply to essentially all HTML elements. These ‘global’ attributes include:

 

Attribute

Description

Applicable to

 

More

accesskey

Shortcut key to activate/focus element

All

Here

class

One or more class names for the element

All

Here. Refers to a class in a CSS style

contenteditable

Indicates whether content is editable

All

Here. New in HTML 5

contextmenu

Specifies context menu (i.e. what appears when right-click)

All

Here. New in HTML 5

data-*

Custom data private to page of application

All

Here. New in HTML 5

dir

Text direction for element content

All

Here. New in HTML 5

draggable

Whether element is draggable

All

Here. New in HTML 5

dropzone

Whether dragged data is copied, moved or linked when dropped

All

Here. New in HTML 5

hidden

Whether element is not relevant

All

Here. New in HTML 5

id

Unique id for an element (for e.g. JavaScript)

All

Here

lang

Language of an element’s content

All

Here

spellcheck

Indicates whether element is to have its spelling and grammar checked

All

Here. New in HTML 5

style

Inline CSS style for an element

All

Here

tabindex

Tab order of an element

All

Here

title

Extra information about element

All

Here

translate

Whether content of an element should be translated

All

Here. New in HTML 5

 


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile