• Skip to main content
  • Skip to search
  • Skip to select language
  • References
    • Overview / Web Technology

      Web technology reference for developers

    • HTML

      Structure of content on the web

    • CSS

      Code used to describe document style

    • JavaScript

      General-purpose scripting language

    • HTTP

      Protocol for transmitting web resources

    • Web APIs

      Interfaces for building web applications

    • Web Technology

      Web technology reference for developers

  • Guides
    • Overview / MDN Learning Area

      Learn web development

    • MDN Learning Area

      Learn web development

    • HTML

      Learn to structure web content with HTML

    • CSS

      Learn to style content using CSS

    • JavaScript

      Learn to run scripts in the browser

    • Accessibility

      Learn to make the web accessible to all

  • MDN Plus
    • Overview

      More MDN. Your MDN.

    • FAQ

      Frequently asked questions about MDN Plus

  • Already a subscriber?
  • Get MDN Plus
  1. Web 开发技术
  2. Web API 接口参考
  3. CSSStyleSheet
  4. CSSStyleSheet.deleteRule()

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

In this article

  • 相关链接

Related Topics

  1. CSS Object Model
  2. CSSStyleSheet
  3. Constructor
    1. CSSStyleSheet() (en-US)
  4. 属性
    1. cssRules (en-US)
    2. ownerRule (en-US)
    3. Deprecated rules (en-US)
  5. 方法
    1. Deprecated addRule() (en-US)
    2. deleteRule()
    3. insertRule()
    4. Deprecated removeRule() (en-US)
    5. replace() (en-US)
    6. replaceSync() (en-US)
  6. 继承
    1. StyleSheet
  7. Related pages for CSSOM
    1. AnimationEvent
    2. CSS
    3. CSSConditionRule
    4. CSSGroupingRule
    5. CSSKeyframeRule (en-US)
    6. CSSKeyframesRule (en-US)
    7. CSSMediaRule
    8. CSSNamespaceRule (en-US)
    9. CSSPageRule
    10. CSSRule
    11. CSSRuleList
    12. CSSStyleDeclaration
    13. CSSStyleRule
    14. CSSSupportsRule
    15. CaretPosition (en-US)
    16. MediaQueryList
    17. Screen
    18. StyleSheet
    19. StyleSheetList
    20. TransitionEvent

In this article

  • 相关链接

CSSStyleSheet.deleteRule()

概述

deleteRule方法用来从当前样式表对象中删除指定的样式规则.

语法

stylesheet.deleteRule(index)

参数

  • index是一个数字,用来指定样式规则的位置.

示例

 myStyles.deleteRule(0);

相关链接

  • insertRule

规范

deleteRule

Found a problem with this page?

  • Edit on GitHub
  • Source on GitHub
  • Report a problem with this content on GitHub
  • Want to fix the problem yourself? See our Contribution guide.

Last modified: 2020年12月8日, by MDN contributors

Your blueprint for a better internet.

  • MDN on Twitter
  • MDN on GitHub

MDN

  • About
  • Hacks Blog
  • Careers

Support

  • Product help
  • Report a page issue
  • Report a site issue

Our communities

  • MDN Community
  • MDN Forum
  • MDN Chat

Developers

  • Web Technologies
  • Learn Web Development
  • MDN Plus
  • Website Privacy Notice
  • Cookies
  • Legal
  • Community Participation Guidelines

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2022 by individual mozilla.org contributors. Content available under a Creative Commons license.