HTML and CSS Reference
In-Depth Information
HTML Tags and Attributes
HTML uses tags such as <h1> and <p> to structure text into headings, paragraphs, lists,
hypertext links, and so on. Many HTML tags have attributes that can be defined in dif-
ferent ways to further structure the content of the Web page. Attributes are the parts of
HTML elements that define them. Attributes provide additional information that a browser
can use to determine things like how to display an element. As an example, the height
and width attributes in the <img> tag describe the size of the image. Global attributes
are those that can be used with most (there are exceptions) HTML tags. HTML4 had a
number of global attributes, and HTML5 has added some new ones (as indicated below).
Table A-2 lists the HTML5 global attributes. This is a comprehensive list of attributes that
are common to all HTML5 elements (with some exceptions).
Table A-2 HTML5 Global Attributes
Attribute
Value
Description
accesskey
character
Specifies a shortcut key to access an element
class
classname
Refers to a class specified in a style sheet
contenteditable
true
false
inherit
Specifies whether a user can edit the content of an element or not
new
contextmenu
menu_id
Specifies a context menu for an element; the value must be the id
of a <menu> element
new
dir
ltr
rtl
auto
Specifies the text direction for the content in an element
draggable
true
false
auto
Specifies whether a user is allowed to drag an element or not
new
dropzone
copy
move
link
Specifies what happens when dragged items/data are dropped
in the element
new
hidden
hidden
Specifies that an element should be hidden
new
id
id
Specifies a unique id for an element
lang
language_code
Specifies the language of the element's content
spellcheck
true
false
Specifies if the element must have its spelling and grammar checked
new
style
style_definitions
Specifies an inline style for an element
tabindex
number
Specifies the tab order of an element
title
text
Specifies extra information about an element
As the W3C continually updates the HTML specifications, HTML tags are added
to, deleted, and replaced by newer tags. Table A-3 lists HTML tags and their associated
attributes. The list provides a brief description of each tag and its values. The default value
for each attribute is indicated by bold text in the Description column. Certain tags and
elements listed in Table A-3 are highlighted as follows:
Search WWH ::




Custom Search