HTML and CSS Reference
In-Depth Information
figure 9-9
Prohibited attributes under the XHtML strict DtD
Element
Prohibited Attributes
a
target
area
target
base
target
body
alink,ƒbgcolor,ƒlink,ƒtext,ƒvlink
br
clear
caption
align
div
align
dl
compact
form
name,ƒtarget
hn
align
hr
align,ƒnoshade,ƒsize,ƒwidth
img
align,ƒborder,ƒhspace,ƒname,ƒvspace
input
align
li
type,ƒvalue
link
target
map
name
object
align,ƒborder,ƒhspace,ƒvspace
ol
compact,ƒstart
p
align
pre
width
script
language
table
align,ƒbgcolor
td
bgcolor,ƒheight,ƒnowrap,ƒwidth
th
bgcolor,ƒheight,ƒnowrap,ƒwidth
tr
bgcolor
ul
type,ƒcompact
Many of the attributes listed in Figure 9-9 are called presentational attributes because
they define how browsers should render the associated elements in Web pages. Note
that all of the attributes listed in Figure 9-9 are supported in the transitional and frameset
DTDs. Therefore, the code
<imgƒsrc=”logo.jpg”ƒalt=”WizardƒWorks”ƒalign=”left”ƒ/>
which uses the align attribute to float an inline image on the left margin of the page, would
not be valid under the strict DTD because the align attribute is prohibited; however, it
would be allowed under the frameset and transitional DTDs. To make this code valid under
all three DTDs, you could replace the align attribute with the CSS float property.
The strict DTD also requires the use of the id attribute in place of the name attribute for
several elements. For example the following tags that you might see in older HTML code
<aƒname=”top”>
<formƒname=”order”ƒaction=” http://www.wizworks.com/order”>
<imgƒname=”logo”ƒalt=”logoƒimage”ƒ/>
<mapƒname=”parkmap”ƒ/>
would be written in XHTML under the strict DTD as follows:
The transitional and
frameset DTDs also require
the use of the id attribute,
but do not reject docu-
ments that contain both the
name and id attributes.
For those DTDs, it's best
to include both attributes
if you want to make your
code backward compatible.
<aƒid=”top”>
<formƒid=”order”ƒaction=” http://www.wizworks.com/order”>
<imgƒid=”logo”ƒalt=”logoƒimage”ƒ/>
<mapƒid=”parkmap”ƒ/>
Search WWH ::




Custom Search