Attributes Flashcards
What are the two parts of an HTML attribute.
name=”value”
Eg, align=”center”
Align attribute and its values
align=”left”
align=”center”
align=”right”
What are the four core attributes?
id
title
class
style
What is the use of the id attribute?
Uniquely identify any element within an HTML page. You can thus identify a single specific element and its content, including distinguishing between elements with the same name within the same web page or style sheet.
Give an example of the id attribute.
<p>This paragraph explains what HTML is...</p>
What is the use of the title attribute?
Similar to the id attribute but the behaviour can change depending on the element type to which it is assigned. Often also displays tooltips when cursor is hovering over the content.
What is the use of the class attribute?
Associate an element with a style sheet and specifies the class of the element.
How many values can the class attribute have?
Multiple values as a space-separated list of class names. Eg, class=”className1 className2 className3”
What is the use of the style attribute?
Specify CSS rules within the element.
Eg, <p style="font-family: arial; color: #FF0000;">Some red arial text…</p>
What are the three internationalisation attributes?
dir
lang
xml:lang
What is the use of the dir attribute?
Indicate to the browser the direction in which the text should flow.
What are the value of the dir attribute?
dir=”ltr” (ltr = left-to-right)
dir=”rtl” (rtl = right-to-left)
What is the use of the lang attribute?
Indicate the lang attribute but only for backwards compatibility with earlier HTML versions.
What is the use of the xml:lang attribute?
Same as lang (indicate language) but for XHTML
What are the values of lang and xml:lang attributes?
ISO-639 standard two-character language codes