W3C DOM2樣式規範

2021-08-21 21:20:43 字數 1219 閱讀 3443

csssty'lesheet物件包含所有的樣式表,包括外部樣式表以及嵌入式樣式表(通過標籤定義).可以同過documentstylesheets獲得該物件,它具有如下屬性:

這裡要注意:

1 其中cssrules屬性在ie中是rules屬性

2 這裡的href,當遇到嵌入的樣式表的時候,在火狐裡面會是null,而在ie8裡面是乙個空字串""

3 insertrule在ie裡面的對應方法為addrule(selector, declaration, index),其中的selector為css選擇器,declaration為乙個由css屬性值對組成的字串,index為要插入的位置。在insertrule方法中,要將新樣式插入末尾,index應該為cssrules陣列的長度,而在ie中index應該為-1.

4 deleterule在ie中對應的方法為removerule(index),其中的index為要刪除的樣式(或者規則)在樣式表中的位置。在ie中,如果要刪除末尾的規則,index不是-1,而是樣式(或者規則)在樣式表中的真實位置。

5 如果要獲取media屬性裡面包含的字串值,w3c裡面應該是stylesheet.media.mediatext(其中safari會自動在末尾加上逗號),而在ie中是stylesheet.media

6 獲得引入樣式表的標籤或者,在w3c裡面是stylesheet.ownernode,而在ie裡面是stylesheet.owningelement。

每個cssstylesheet物件裡面包含一組cssstylerule物件,它們具有以下屬性:

通過cssrules或者rules的style屬性獲取的總是樣式表中的屬性值,而不管標籤元素有沒有內聯的style屬性

這個物件具有的屬性如下:

這三個方法是w3c裡面的方法,而且propertyname是world-world型別(如:background-color),ie不支援

實用的css3樣式

1.word wrap word wrap normal break word 只在允許的斷字點換行 瀏覽器保持預設處理 斷字 在長單詞或url位址內部進行換行。2.font face internet explorer 9 firefox,chrome,safari,和 opera 支援 woff...

css3樣式有哪些?

2d 轉換 2d 轉換是改變標籤在二維平面上的位置和形狀 移動 translate 旋 rotate 縮放 scale translate 語法 x 就是 x 軸上水平移動 y 就是 y 軸上水平移動 transform translate x,y transform translatex n tr...

css3樣式總結 漸變,文字樣式等

一.css3的文字屬性 1.陰影 text shadow 水平陰影 垂直陰影 模糊半徑 陰影顏色 doctype html html head title css3 text shadow屬性 title style type text css lvye style head body div id...