[英]How to get all the applied styles of an element by just giving its id?
[英]Is it possible to get all applied Styles and not just the computed
假設您有一個樣式表,頂部有以下聲明:
a {color: black; color: rgba(255, 255, 255, 0.6)}
所以,如果我運行document.styleSheets[0].cssRules[0].cssText
我會回來
a{color: rgba(255, 255, 255, 0.6)}
有沒有可能得到所有的風格,而不僅僅是計算?
不, cssText
實際上是一個訪問器,就像innerHTML
一樣。 這意味着,您無法恢復瀏覽器已消除的任何規則。 除非您手動解析CSS文件。 (...我不推薦。為什么你還想這樣做?)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.