Share this Page URL

Chapter 6. CSS Units > Strings - Pg. 72

CSS Units 72 Strings "String" is a programming term that relates to displaying or manipulating functions based on text. The string equivalent of the hexadecimal color value #FF0000 is "red", and both are equally un- derstood by browsers when used in either XHTML objects or as values within a given CSS property. Normally, quote marks are not used when specifying text values in CSS. The sole exception to this rule is when you need to set a specific font value. The font-family property allows Web authors to select a particular font on a user's system by placing it within quotes, for example: font-family: "Arial Black", Arial, sans-serif In this case, the "Arial Black" will only make a match with a font of exactly the same name on the user's system -- it will not match similar font names, such as "Arial Narrow" or "Arial Rounded MT Bold." Additionally, in this case it is important to use quotes because of the space contained within the name of this font, as "Arial Black" and Arial Black (without quotes) are not equivalent; in the latter case, the browser will first search for a font called Arial, then for one called Black. Of course, when- ever you do use such a specific font setting, it is in your interest to use a setting that is commonly found on most computing systems. You are relatively safe with a setting like "Times Roman", as opposed to a less-common font such as "Poor Richard", "Matisse ITC" or "Franklin Gothic Demi". In CSS, strings of text -- like those used when generating automatic content -- can be contained within sets of single or double quotes. So, for example, the following code snippet contains two valid strings: "The quick brown fox jumped over the lazy dog." 'The quick brown fox jumped over the lazy dog.'