2012-01-11 64 views
3

正如我從我的發展和研究記得,我還沒有面臨CSS屬性,允許設置彗星分離值。或者,也許我遇到了他們,但很少,因此不記得任何。 我不是指過濾器屬性值,但他們也是值得注意的。哪些CSS屬性允許使用逗號分隔值?

請你指出,如果你知道的(CSS2,3套裝)?如果它們完全存在?

得到答案後,我要檢查W3C Reference以確定它們是否存在。

例子:

selector { property: value, value, value; } 
+3

'background-image' for one - 你可以一次設置[多個背景圖像](https://developer.mozilla.org/en/CSS/Multiple_backgrounds)。 – 2012-01-11 14:08:35

+0

@ŠimeVidas,真的,非常好的補充。 – 2012-01-11 14:12:21

+0

@easwee該列表僅適用於CSS 2屬性。 CSS 3模塊添加了很多新的屬性......我不知道所有CSS 3屬性的任何單個屬性索引表。 – 2012-01-11 14:24:16

回答

8

你真的只需要參考the property table

任何CSS功能,如rgb(),需要其參數爲CSV(即rgb(107, 203, 84)

CSS2中,可能通過逗號分隔的屬性是:

  • cursor –如果你使用自定義<uri>
  • font –看到font-family
  • font-family –分隔每個字體家族值(即, Arial, sans-serif
  • voice-family –代表<specific-voice><generic-voice>選項。

找到所有可能允許CSV的CSS3屬性有點難度。 CSS3被視爲一組模塊來增強CSS2,而不是全面取代CSS2的規範。

CSS backgrounds and Borders Module Level 3允許以下屬性,以支持CSV:

  • background –多個背景規則是分開的,由於這所有的背景子屬性也可以使用CSV
  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background-position
  • background-clip
  • background-origin
  • background-size

CSS Color Module Level 3添加rgba()hsl()hsla()顏色的功能,所有這些都採取用逗號分隔的參數

CSS Text Level 3

  • text-shadow

CSS Transitions Module Level 3

  • transition –類似於background,多個轉換由,分離,並且所有子屬性也使用CSV。
  • transition-delay
  • transition-duration
  • transition-property
  • transition-timing-function

CSS Animations Module Level 3

  • animation –看到transition
  • animation-delay
  • animation-direction
  • animation-duration
  • animation-iteration-count
  • animation-name
  • animation-play-state
  • animation-timing-function

cubic-bezier()功能

CSS Fonts Module Level 3

  • font-feature-settings

character-variant()styleset()

+1

http://stackoverflow.com/questions/6187085/full-css-property-table – easwee 2012-01-11 14:31:10

+0

@easwee,感謝您的鏈接 – zzzzBov 2012-01-11 16:05:40

1

只有逗號分隔符號我知道CSS這是一個:

p { 
    color:rgb(0,0,255); 
} 
+0

0,0,255是rgb的值。顏色的值是rgb(0,0,255),所以不會用逗號分隔。我對上述示例中所示的問題感興趣。 – 2012-01-11 14:09:53

7

別人

selector { 
    font-family: "lucida grande" , tahoma, Arial; 
    background-image: linear-gradient(top,#f5f5f5,#f1f1f1); 
} 
+1

font-family,是直接點。任何其他? – 2012-01-11 14:10:49

2

多重背景:

background: url(sheep.png) center bottom no-repeat, url(betweengrassandsky.png) left top no-repeat; 

有幾個與背景相關的,更像是子屬性而不是直接屬性。

線性漸變:

background-image: linear-gradient(bottom, rgb(184,33,91) 49%, rgb(221,60,119) 75%); 

徑向漸變:

background-image: radial-gradient(center center, circle contain, black 0%, blue 25%, green 40%, red 60%, purple 80%, white 100%); 

另外,@字體面的src屬性,但是@字體面是不是一個真正的選擇,所以稍微偏離主題對你的問題。但仍然相關。

@font-face { 
    font-family: bodytext; 
    src: url(ideal-sans-serif.woff) format("woff"), 
     url(basic-sans-serif.ttf) format("opentype"); 
} 
5

CSS3 text-shadowbox-shadow和屬性:

 
p{ 

    text-shadow: 1px 1px #000, -2px -2px #fff; 

} 

因此是分開的相同屬性,M '值'多重文字陰影或方塊陰影