Saturday 26 March 2016

HTML Attribute Reference

HTML Attribute Reference



There are few HTML attributes which are standard and associated to all the HTML tags. These attributes are listed here with a brief description.

Global Attributes

Not valid in base, head, html, meta, param, script, style, and title elements.

Attribute
HTML-5
Description
accesskey

Specifies a shortcut key for an element to be used in place of keyboard.
class

The class of the element
contenteditable
Yes
Boolean attribute to specify whether the element is editable or not.
contextmenu
Yes
Specifies a context menu for an element.
data-*
Yes
Used to store custom data associated with the element.
draggable
Yes
Boolean attribute to specify whether the element can be dragged or not.
dropzone
Yes
Specifies whether the dragged data is copied, moved, or linked, when dropped.
hidden
Yes
Specifies whether element should be visible or not.
id

A unique id for the element
spellcheck
Yes
Specifies if the element must have it's spelling or grammar checked.
style

An inline style definition
tabindex

Specifies the tab order of an element.
title

A text to display in a tool tip
translate
Yes
Boolean attribute specifies whether the content of an element should be translated or not


Language Attributes
The lang attribute indicates the language being used for the enclosed content. The language is identified using the ISO standard language abbreviations, such as fr for French, en for English, and so on. RFC 1766 (http://www.ietf.org/rfc/rfc1766.txt) describes these codes and their formats.

Not valid in base, br, frame, frameset, hr, iframe, param, and script elements.

Attribute
Value
Description
dir
ltr | rtl
Sets the text direction
lang
language_code
Sets the language code

No comments:

Post a Comment