HTML and CSS Reference
In-Depth Information
Elements
Elements
are designators that define the structure and content of objects within a page.
Some of the more frequently used elements include multiple levels of headings (identified
as
<h1>
through
<h6>
elements) and paragraphs (identified as the
<p>
element); the list
goes on to include the
<a>
,
<div>
,
<span>
,
<strong>
, and
<em>
elements, and many
more.
Elements are identified by the use of less-than and greater-than angle brackets,
< >
, sur-
rounding the element name. Thus, an element will look like the following:
1.
<a>
Tags
The use of less-than and greater-than angle brackets surrounding an element creates what
is known as a
tag
. Tags most commonly occur in pairs of opening and closing tags.
An
opening tag
marks the beginning of an element. It consists of a less-than sign followed
by an element's name, and then ends with a greater-than sign; for example,
<div>
.
A
closing tag
marks the end of an element. It consists of a less-than sign followed by a
forward slash and the element's name, and then ends with a greater-than sign; for example,
</div>
.
The content that falls between the opening and closing tags is the content of that element.
An anchor link, for example, will have an opening tag of
<a>
and a closing tag of
</a>
.
What falls between these two tags will be the content of the anchor link.
So, anchor tags will look a bit like this:
1.
<a>
...
</a>
Attributes
Attributes
are properties used to provide additional information about an element. The most
common attributes include the
id
attribute, which identifies an element; the
class
attrib-
ute, which classifies an element; the
src
attribute, which specifies a source for embed-
dable content; and the
href
attribute, which provides a hyperlink reference to a linked
resource.
Attributes are defined within the opening tag, after an element's name. Generally attributes
include a name and a value. The format for these attributes consists of the attribute name
followed by an equals sign and then a quoted attribute value. For example, an
<a>
element
including an
href
attribute would look like the following:
Search WWH ::
Custom Search