Peter Alfvin
Peter Alfvin

Reputation: 29399

Can CSS property values be quoted?

From browsing the web, it seems that CSS property values, like HTML property values, can be quoted or not. However, in JSFiddle, I can only get the CSS to work if the values are unquoted.

Here's the HTML example:

<div id="withQuotes">The CSS for this has quoted parameter values.</div>
<div id="withoutQuotes">The CSS for this has unquoted parameter values.</div>

And here's the CSS:

#withQuotes {
font-size:"x-large";
width:'100px';}

#withoutQuotes {
    font-size:x-large;
    width:100px;
}

The above is saved in http://jsfiddle.net/8EMyW/

Upvotes: 2

Views: 844

Answers (1)

Paul
Paul

Reputation: 141827

No, CSS properties in general cannot be quoted. Some CSS properties can have quotes in their values though, like:

background: url('quoted/path');

Certain CSS properties also accept a string as their value, which of course must be surrounded by quotes. font-family is an example of a property which can accept a string.

Upvotes: 8

Related Questions