HTML and CSS Reference
In-Depth Information
This might seem a little bit silly until you consider that not all values have explicitly
defined initial values. For example, the initial value for color is “depends on user agent.”
That's not a funky keyword you should type! What it means is that the default value
of color depends on things like the preferences settings in a browser. While almost
nobody changes the default text color setting from black, someone might set it to a
dark gray or even a bright red. By declaring color: initial; , you're telling the browser
to set the color of the element to whatever the user's default color is set to be.
As of mid-2012, there was limited browser support for initial : Safari
and Chrome supported it as-is, whereas Firefox supported it as
-moz-initial .
Strings
A string value is an arbitrary sequence of characters wrapped in either single or double
quotes, and is represented in value definitions with <string> . Two simple examples:
"I like to play with strings."
'Strings are fun to play with.'
Note that the quotes balance, which is to say that you always start and end with the
same kind of quotes. Getting this wrong can lead to all kinds of parsing problems, since
starting with one kind of quote and trying to end with the other means the string won't
actually be terminated. You could accidentally incorporate following rules into the
string that way!
If you want to put quote marks inside strings, that's okay as long as they're either not
the kind you used to enclose the string or are escaped using a backslash.
"I've always liked to play with strings."
'He said to me, "I like to play with strings."'
"It's been said that \"haste makes waste.\""
'There\'s never been a "string theory" that I\'ve liked.'
Note that the only acceptable string delimiters are ' and " , sometimes called “straight
quotes.” That means you can't use “curly” or “smart” quotes to begin or end a string
value. You can use them inside a string value, though, and they don't have to be escaped.
"It's been said that “haste makes waste.”"
'There's never been a “string theory” that I've liked.'
Of course, this requires that you use Unicode encoding for your documents, but you
should be doing that regardless.
If you have some reason to include a newline in your string value, you can do that by
escaping the newline itself. CSS will then remove it, making things as if it had never
been there. Thus, the following two string values are identical from a CSS point of view:
 
Search WWH ::




Custom Search