首页 > CSS的属性, 什么时候要加引号, 什么时候不加?

CSS的属性, 什么时候要加引号, 什么时候不加?

有人总结相应的规律吗?


当属性值是字符串类型的的时候加引号呀,比如

cssh1 {
    font-family: "New Century Schoolbook", serif;
    background: url("http://www.example.com/pinkish.png");
}
h1::before{
    content: "\e020";
}

另外, CSS 中的属性值类型有只有下面几种:

  1. Integers and real numbers
  2. Lengths, Percentages
  3. URLs and URIs
  4. Counters
  5. Colors
  6. Strings
  7. Unsupported Values

参考:
1. http://www.w3.org/TR/2011/REC-CSS2-20110607/fonts.html#font-family-pro...
2. http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#values


这是不需要总结的规律,你看完规范就什么都知道了。

【热门文章】
【热门文章】