HTMLStyleElement
HTMLStyleElement
接口表示 <style>
元素。它从 HTMLElement
和 LinkStyle
(en-US) 中继承属性和方法。
这个接口不允许修改包含其中的CSS(大多数情况下)。如果需要修改CSS,前往关于使用动态样式的信息查看在DOM中用于修改特定CSS属性的对象。
属性
Inherits properties from its parent, HTMLElement
, and implements LinkStyle
(en-US).
HTMLStyleElement.media
(en-US)- Is a
DOMString
representing the intended destination medium for style information. HTMLStyleElement.type
(en-US)- Is a
DOMString
representing the type of style being applied by this statement. HTMLStyleElement.disabled
- Is a
Boolean
(en-US) value representing whether or not the stylesheet is disabled (true) or not (false). LinkStyle.sheet
(en-US) 只读- Returns the
StyleSheet
object associated with the given element, ornull
if there is none HTMLStyleElement.scoped
(en-US) Non-Standard- Is a
Boolean
(en-US) value indicating if the element applies to the whole document (false
) or only to the parent's sub-tree (true
).
方法
No specific method; inherits properties from its parent, HTMLElement
, and LinkStyle
(en-US).
规范
规范 | 状态 | 注释 |
---|---|---|
HTML Living Standard HTMLStyleElement |
Living Standard | |
HTML 5.1 HTMLStyleElement |
Recommendation | |
HTML5 HTMLStyleElement |
Recommendation | The following property has been added: scoped . |
Document Object Model (DOM) Level 2 HTML Specification HTMLStyleElement |
Obsolete | Added a second inheritence, the LinkStyle (en-US) interface. |
Document Object Model (DOM) Level 1 Specification HTMLStyleElement |
Obsolete | Initial definition |
浏览器兼容性
BCD tables only load in the browser
参见
- The HTML element implementing this interface:
<style>
. - Using dynamic styling information to see how to manipulate CSS.