Ebooks
Pro HTML5 with CSS, JavaScript, and Multimedia : Complete Website Development and Best Practices
An opening tag can include one or more attributes and there are two examples of this in the sample
document. Later in this chapter I will explain the different attributes that can be used. Attributes are used to
provide details about an element. The html element, for example, contains lang="en", which informs the
browser that the content is written in English. The browser may use this to offer to translate the content if
English is not the current language.
There is a set of attributes called global attributes that can be used on any HTML element. A complete
list of these is provided with other reference material in Appendix C. The most common ones that you’ll
use are id and class. The id attribute defines a unique key for an element; it must be unique within the
entire HTML document. This is often used when accessing an element in JavaScript. The class attribute
is sometimes called the CSS class, because it is often used for applying styles to an element. Unlike id,
the class attribute is a non-unique key; a single value is applied to elements that need to have identical
formatting.
Tidak ada salinan data
Tidak tersedia versi lain