Online
 
Sunday, 23 November 2008
 
 

Attributes Tell Us About Elements | Print |  E-Mail
 
Attributes Tell Us About Elements
In order to specify which font you want to use, the <font> element must carry an attribute called face.
It is important to take a moment now to look at attributes, as they are used a lot in HTML.
You can use attributes to say something about an element. They appear on the opening tag of the element
that carries them. All attributes are made up of two parts: a name and a value:
❑ The name is the property you want to set. For example, the <font> element in the example
carries an attribute whose name is face, which you can use to indicate which typeface you want
the text to appear in.
❑ The value is what you want the value of the property to be. The first example was supposed to use
the Arial typeface, so the value of the face attribute is Arial.
The value of the attribute should be put in double quotation marks, and is separated from the name by
the equals sign. You can see that a color for the text has been specified as well as the typeface in this
<font> element:
<font face="arial" color="#CC0000">
This illustrates that elements can carry several attributes, although an element should never have two
attributes of the same name.
You might have noticed that the value of the color attribute is #CC0000, which might seem a strange
way to describe a red, but there are many shades of red and this notation allows us to describe lots of
different reds. Don’t worry about it for now; you learn all about color in Chapter 4. As you will see in that
chapter, colors on the Web can be described using six-digit codes preceded by the pound (or hash) sign #
and the characters after it represent the amount of red, green, and blue used to make up the color. The
same notation is used for the bgcolor attribute on the <body> element, which indicates that we want
the background of our page to be a very light gray. (Appendix D also lists over 100 color names and their
corresponding numbers.)
This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 4000
 Notify me of follow-up comments
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

Rokok Kretek Jumbo Coklat

“Terbuat dari tembakau, saos dan cengkeh pilihan kwalitas tinggi sehingga menghasilkan rokok dengan rasa yang cocok untuk segala cuaca”
Jumbo Coklat - Powered By G-Ads

 
Top! Top!