HTML and CSS Reference
In-Depth Information
style : Specifies CSS style properties for the element. This is known as inline styling , which you'll
learn more about in the next chapter. Although the style attribute is valid for most elements, it
mixes presentation with your content so you should avoid using it whenever possible.
title : Supplies a text title for the element. This might be a note, a label, a warning, or indeed a
title—the attribute accepts any short bit of text. Many graphical browsers display the value of a
title attribute in a “tooltip,” a small, floating window displayed when the user's cursor lingers
over the rendered element.
hidden : Indicates that the element is not relevant and that the browser shouldn't render it. This
Boolean attribute is somewhat controversial—arguably, irrelevant and invisible elements
shouldn't be in the document in the first place. The attribute was introduced because there may
be some unusual situations when an element is irrelevant in one context but relevant in another.
For example, a page might have special navigation that should be visible on a mobile device but
should never be seen on a desktop computer, or a log in form that isn't relevant to users who are
already logged in. The intent is that dynamic scripts could toggle the attribute to hide or show
elements as needed, but there's a lot of potential for careless authors to misuse the hidden
attribute, hence the debate on whether it should be allowed in HTML5 at all. This attribute should
not be used to arbitrarily hide any old content you might want to hide. We've included the hidden
attribute in this list because you might encounter it in the wild, and you might even come up with a
legitimate use for it—but do so with care.
Previous versions of HTML and XHTML imposed much stricter limitations on class and
id values. No punctuation or symbols were allowed other than hyphens and
underscores, and an ID had to begin with a letter of the alphabet, not a numeral or
symbol. HTML5 has loosened these restrictions but they still apply if you're working with
an HTML 4.01 or XHTML 1.0 document.
Internationalization Attributes
Internationalization attributes contain information about the natural language in which an element's
contents are written such as English, French, Tamil, Latin, Klingon, and so forth. They can be included in
almost any element, especially those that contain text in a language different from the rest of the
document's content.
dir : Sets the direction in which the text should be read, as specified by a value of ltr (left to
right) or rtl (right to left). This attribute usually isn't necessary because a language's direction
should be inferred from the lang attribute. It's a good idea to include it just the same. Most Earth
languages are read left to right, with Arabic, Persian, and Hebrew being the most common right to
left alphabets.
lang : Specifies the natural language of the enclosed content, indicated by an abbreviated
language code such as en for English, es for Spanish (Español), ja for Japanese, ar for Arabic,
rn for Kirundi, and so on. You can find a listing of the most common language codes at .
Search WWH ::

Custom Search