HTML and CSS Reference
In-Depth Information
9.2.7. The class, style, lang, and dir Attributes
The
style
attribute creates an inline style for the elements enclosed by
the form, overriding any other style rules in effect. The
class
attribute
lets you format the content according to a predefined class of the
<form>
tag; its value is the name of that class. [
Inline Styles: The style Attrib-
The actual effects of
style
with
<form>
are hard to predict, however. In
general, style properties affect the body contenttext, in particularthat
you may include as part of the form's contents, but
<form>
styles do af-
fect the display characteristics of the form elements.
For instance, you may create a special font face and background color
style for the form. The form's text labels, but not the text inside a text-
input form element, appear in the specified font face and background
color. Similarly, the text labels you put beside a set of radio buttons
appear in the form-specified style, but the radio buttons themselves do
not.
The
lang
attribute lets you specify the language used within the form,
with its value being any of the ISO standard two-character language
abbreviations, including an optional language modifier. For example,
adding
lang=en-UK
tells the browser that the list is in English ("en")
as spoken and written in the United Kingdom ("UK"). Presumably, the
browser may make layout or typographic decisions based upon your lan-
guage choice.
Similarly, the
dir
attribute tells the browser in which direction to display
the list contentsfrom left to right (
dir=ltr
), like English and French, or
from right to left (
dir=rtl
), as with Hebrew and Chinese.
The popular browsers support the
dir
and
lang
attributes, even though
no behaviors are defined for any specific language. [
The dir attribute,