HTML5 Attributes

Elements may contain attributes that are used to set various properties of an element.
Attributes may only be specified within start tags and must never be used in end tags.
HTML5 attributes are case insensitive and may be written in all uppercase or mixed case, although the most common convention is to stick with lowercase.
The attributes listed below are supported by almost all the HTML 5 tags.
Attribute
Options
Function
accesskey
User Defined
Specifies a keyboard shortcut to access an element.
align
right, left, center
Horizontally aligns tags
background
URL
Places an background image behind an element
bgcolor
numeric, hexidecimal, RGB values
Places a background color behind an element
class
User Defined
Classifies an element for use with Cascading Style Sheets.
contenteditable
true, false
Specifies if the user can edit the element's content or not.
contextmenu
Menu id
Specifies the context menu for an element.
data-XXXX
User Defined
Custom attributes. Authors of a HTML document can define their own attributes. Must start with "data-".
draggable
true,false, auto
Specifies whether or not a user is allowed to drag an element.
height
Numeric Value
Specifies the height of tables, images, or table cells.
hidden
hidden
Specifies whether element should be visible or not.
id
User Defined
Names an element for use with Cascading Style Sheets.
item
List of elements
Used to group elements.
itemprop
List of items
Used to group items.
spellcheck
true, false
Specifies if the element must have it's spelling or grammar checked.
style
CSS Style sheet
Specifies an inline style for an element.
subject
User define id
Specifies the element's corresponding item.
tabindex
Tab number
Specifies the tab order of an element.
title
User Defined
"Pop-up" title for your elements.
valign
top, middle, bottom
Vertically aligns tags within an HTML element.
width
Numeric Value
Specifies the width of tables, images, or table cells.

Find complete list of HTML5 Tags here.
Custom Attributes:
data-??? = you define
you can specify custom attributes that will validate for an element. using the prefix "data-" you can name the attribute whatever you like. And the value for the data can be any type of value.
<div data-aaa="solid" data-peepee="ppp">
    Content for Div goes here
</div>

In the example above I created two custom data attributes. One named "data-poopoo" and the other is "data-peepee". They both hold user defined values that correspond to them.


SHARE
    Blogger Comment
    Facebook Comment