HTML and CSS Reference
In-Depth Information
elements, such as
center
and
font
that are excluded from the Strict variant. XHTML 1.0 Strict is the XML equivalent
of HTML 4.01 Strict, which includes strictly those elements that have not been deprecated.
The XHTML versions and variants provide a different set of elements. There are 89 elements in XHTML 1.0
Transitional, 92 in XHTML 1.0 Frameset, 78 in XHTML 1.0 Strict, 83 in XHTML 1.1, 99 in XHTML 2.0, and 108 in
XHTML5 (the same as in HTML5) [40]. The
applet
,
basefont
,
center
,
dir
,
font
,
isindex
,
menu
,
s
,
strike
, and
u
elements have been deprecated in XHTML 1.0. Consequently, they can be used in XHTML 1.0 Transitional or XHTML
1.0 Frameset but not in XHTML 1.0 Strict or above. Many web designers did not understand this important fact and
applied the Transitional variant of HTML4 or XHTML 1.0 for more than a decade. A Transitional variant, even in
standard-compliant files, allows obsolete elements deprecated in the specification with the intention to indicate that
these elements will be removed from future markup versions and thus should not be used. In other words, millions of
web sites have used a markup until recently that allowed elements already obsoleted in HTML 4.01!
XHTML 1.0 Strict and XHTML 1.1 have a very similar set of elements. The most important differences are that
XHTML 1.1 introduced the
Ruby elements
and removed the
access
element. Prior to XHTML 1.1, the
lang
attribute
was used (instead of
xml:lang
which is preferred today). The
name
attribute for anchors and client-side maps was
used until XHTML 1.0, which should be replaced by the
id
attribute from XHTML 1.1. The essence of XHTML 1.1 is
that elements are collected to
modules
, making it possible to apply subsets of the full element set in environments
with limited resources (for example, mobile devices), known as
XHTML modularization
(as mentioned earlier in the
chapter).
XHTML 2.0 has several elements that are not found in any other markup language, namely,
action
,
delete
,
di
,
dispatch
,
ev:listener
,
group
,
h
,
handler
,
insert
,
l
,
load
,
message
,
model
,
nl
,
output
,
range
,
rebuild
,
recalculate
,
refresh
,
repeat
,
reset
,
revalidate
,
secret
,
section
,
select1
,
send
,
bseparator
,
setfocus
,
setindex
,
setvalue
,
standby
,
submit
,
summary
,
switch
,
trigger
, and
upload
. These elements were introduced in XHTML 2.0 but
discontinued in (X)HTML5. XHTML 2.0 supports some XHTML 1.1 elements too, some of which are also included in
(X)HTML5, such as
ruby
, while others have been excluded, such as
rtc
. The core elements were derived from earlier
versions.
The latest version of XHTML, XHTML5, has the same set of elements as HTML5, as mentioned earlier. The most
significant extension of markup elements and attributes in the past decade has been realized in (X)HTML5, especially
because of the newly introduced structuring and multimedia elements not supported by any earlier versions.
Block vs. Inline Elements
To provide full control over different document sections, HTML elements are on different levels. Similar to the
character, paragraph, and document formatting levels used in word processors, HTML provides tags with different
scopes. Certain elements, known as
inline elements
, can be applied both on individual characters and on strings, such
as font features, italic or bold texts, subscripts, and superscripts.
10
They are usually placed in paragraphs (
p
) or divisions
(
div
) that contain text and/or inline elements. These containers are the block elements that form the basic structure
of web documents. These elements can also be the containers of other block elements. Block-level elements have their
own block margins, width, and height properties that can be set independently from other parts of the document (see
Chapter 5). Block-level elements are usually rendered on a new line. In contrast, inline elements are treated as parts of
the text flow and cannot have margins, cannot have width or height properties, and do break across lines.
In Listing 3-27, the paragraph below the heading begins in a new line, because both
h1
and
p
are block-level
elements. The emphasized text in the paragraph (between
<em>
and
</em>
) is rendered continuously and does not
begin in a new line, because
em
is an inline element. While the
div
might have margins (set from CSS), the
em
cannot.
10
Obsolete HTML elements used exclusively for character formatting should be substituted by CSS. (These styling elements have
been removed from the Strict variants, and later from all other versions.)
Search WWH ::
Custom Search