CHAPTER 4. HTML TAGS AND ATTRIBUTES 45
<img ... width=100 />(right)
<img ... width='100' />(right)
<img ... width=100/>(wrong)
<img ... width='100'/>(okay but discouraged)
In the “wrong” case, it is wrong because the slash (/) becomes part of the
value. That is, width is100/instead of being just 100.
That is why some authors will tell you to leave a space before/>at the end
of a tag.
Exam Question 78(p.341):In<img ... width=’100’/>what is the value
of width?
Required Answer: 100
Exam Question 79(p.341):In<img ... width=100 />what is the value
of width?
Required Answer: 100
Exam Question 80(p.341):In<img ... width=100/>what is the value
of width?
Required Answer:100/
4.4 Global Attributes
Some attributes can be included on any HTML tag. These are called the
global attributes. They are universally available. Here is a complete list: ac-
cesskey, class, contenteditable, contextmenu, dir, draggable, dropzone, hid-
den, id, lang, spellcheck, style, tabindex, title, and translate.
Exam Question 81(p.341):List the four commonly-used global attributes
for HTML tags.
Required Answer:id, class, style, title
http://www.w3.org/TR/html-markup/global-attributes.htmlhas more.
http://www.w3schools.com/tags/ref_standardattributes.asphas more.