CSS Value String
A String in CSS is a text value assigned to a property. Strings are a sequence of characters enclosed in either single or double quotes.
Example: 'w3wiki' is a String "w3wiki" is a String
quotes inside a string are not allowed and needs to be escaped with a \ like “this is a \”(double quote) “.
All text values other than the CSS keywords that are enclosed in double-quotes or single quotes are considered as strings in CSS.
For example:
content property in CSS takes in a String (contents to be inserted) as value.
<!DOCTYPE html> < html > < head > < style > #insert:after{ content: "Welcome to w3wiki"; } </ style > </ head > < body > < h1 > CSS Value/ String </ h1 > < div id = "insert" > </ div > </ body > </ html > |
Output:
Another example would be to assign background image. The URL to the background image would be enclosed in a double quote which indicates that the background-image property takes in a string value
<!DOCTYPE html> < html > < head > < style > body { background-image: url("w3wiki.png"); background-color: #cccccc; } </ style > </ head > < body > < h1 >CSS Value/String</ h1 > </ body > </ html > |
Output:
Contact Us