The core attributes may be assigned to almost all HTML elements. They cannot be used with the elements belonging to the head section (<head> tag) and the <html> itself. Beside that there are other few minor differences to pay attention to.
Related elements:
id attribute:
All elements but BASE, HEAD, HTML, META, SCRIPT, STYLE, TITLE
class attribute:
All elements but BASE, BASEFONT, HEAD, HTML, META, PARAM, SCRIPT, STYLE, TITLE
style attribute:
All elements but BASE, BASEFONT, HEAD, HTML, META, PARAM, SCRIPT, STYLE, TITLE
title attribute:
All elements but BASE, BASEFONT, HEAD, HTML, META, PARAM, SCRIPT, TITLE
Attribute characteristics and purpose:
id attribute:
- dedicates a name to an element and must be unique in a document
- often used as an element's identifier for style sheets, scripts, target anchors or other server or client based interactions
class attribute:
- assigns a class name to an element; any number of elements may share the same class name or names
- mostly used for styling with style sheets or other type of referencing (via DOM programming)
style attribute:
- specifies inline styles information for an element
title attribute:
- description or summary of an element
- most of the browsers will use this attribute as a "tool tip" that appears after "hovering" over the element
Example
HTML core attributes:
Comments
No comments have been made yet.
Please login to leave a comment. Login now