HTML and CSS Reference
In-Depth Information
media
The draft HTML5 specification suggests the value should be used to indicate
whether a destination is appropriate for screen, print, PDA, and so on. This is an advisory
property and does not restrict action.
methods
The value of this attribute provides information about the functions that might be
performed on an object. The values generally are given by the HTTP protocol when it is
used; as for the
title
attribute, it might be useful to include advisory information in
advance in the link. For example, the browser might choose a different rendering of a link as
a function of the methods specified; something that is searchable might get a different icon,
or an outside link might render with an indication of leaving the current site. This attribute
is neither well understood nor supported, even by the defining browser, Internet Explorer.
name
This attribute is required in an anchor defining a target location within a page. A value
for
name
is similar to a value for the
id
core attribute, and it should be an alphanumeric
identifier unique to the document. Under the HTML and XHTML specifications,
id
and
name
both can be used with an
<a>
tag as long as they have identical values. HTML5 directly states
page authors should not use
name
even though it may be supported in browsers and
id
values should be used instead.
ping
This HTML5-specific attribute is used to specify the URL(s) that will be notified
when a link is activated. If more than a single URL is specified, the addresses should be
separated by spaces. Despite some early Firefox dablings with this attribute by late 2009, no
browser implements this feature, and privacy concerns about this attribute may keep it
from ever being widely adopted.
rel
For anchors containing the
href
attribute, this attribute specifies the relationship of the
target object to the link object. The value is a comma-separated list of relationship values.
The values and their semantics will be registered by some authority that might have
meaning to the document author. The default relationship, if no other is given, is
void
. The
rel
attribute should be used only when the
href
attribute is present. Table 3-8 lists possible
rel
values defined in HTML5 for
<a>
tags.
rev
This attribute specifies a reverse link, the inverse relationship of the
rel
attribute. It is
useful for indicating where an object came from, such as the author of a document.
shape
This attribute is used to define a selectable region for hypertext source links
associated with a figure in order to create an image map. The values for the attribute are
circle
,
default
,
polygon
, and
rect
. The format of the
coords
attribute depends on the
value of
shape
. For
circle
, the value is
x,y,r
, where
x
and
y
are the pixel coordinates for
the center of the circle and
r
is the radius value in pixels. For
rect
, the
coords
attribute
should be
x,y,w,h
. The
x,y
values define the upper-left corner of the rectangle, while
w
and
h
define the width and height, respectively. A value of
polygon
for
shape
requires
x1,y1,x2,y2,
… values for
coords
. Each of the
x,y
pairs defines a point in the polygon, with
successive points being joined by straight lines and the last point joined to the first. The value
of
default
for
shape
requires that the entire enclosed area, typically an image, be used.
N
OTE
It is advisable to use the
usemap
attribute for the
img
element and the associated
map
element to define hotspots instead of the
shape
attribute.