例如,CSS cursor
屬性有以下允許值:url | auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing
如何獲得給定CSS屬性的所有允許值的數組?
,我需要把它們都(禁止url
也許)在JS數組。
問題是,如何創建這樣一個數組? OFc我可以硬編碼它,但如果在將來添加另一個允許的值,或者值被棄用或刪除......那麼,有沒有任何方式提供的語言來獲得這樣一個數組?
此外,當然,從一些像MDN甚至從標準網頁,這將是一個矯枉過正的文件站點獲取此。
只有真正的方法是需要維護的列表。 – epascarello
不,據我所知,沒有辦法獲取一個樣式的有效值列表,你必須用列表硬編碼 – adeneo
看看這裏:https://stackoverflow.com/questions/11219691/list-of-all-css-properties-and-allowed-values – Woodrow