Get to know MDN better
此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
HTMLStyleElement 接口表示 <style> 元素。它从 HTMLElement 和 LinkStyle 中继承属性和方法。
这个接口不允许修改包含其中的 CSS(大多数情况下)。如果需要修改 CSS,前往关于使用动态样式的信息查看在 DOM 中用于修改特定 CSS 属性的对象。
EventTarget Node Element HTMLElement HTMLStyleElementInherits properties from its parent, HTMLElement, and implements LinkStyle.
HTMLStyleElement.mediaIs a DOMString representing the intended destination medium for style information.
HTMLStyleElement.typeIs a DOMString representing the type of style being applied by this statement.
HTMLStyleElement.disabledIs a Boolean value representing whether or not the stylesheet is disabled (true) or not (false).
LinkStyle.sheet 只读Returns the StyleSheet object associated with the given element, or null if there is none
HTMLStyleElement.scopedIs a Boolean 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.
| HTML # htmlstyleelement |
启用 JavaScript 以查看此浏览器兼容性表。